Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransformCallback - type 'null' is not assignable to parameter of type 'Error' #413

Open
mirages opened this issue Nov 25, 2020 · 0 comments

Comments

@mirages
Copy link

mirages commented Nov 25, 2020

I write my transform plugin with ts locally, and import the TransformContext and TransformCallback type from karma-typescript:

import type { TransformContext, TransformCallback } from 'karma-typescript'

export default async function (context: TransformContext, cb: TransformCallback) {
  if (/\.(less|css)$/.test(context.filename)) {
    // do something
    cb(null, true)
  } else {
    cb(null, false)
  }
}

When I run my karma.conf.ts with ts-node, an error occurred:

error TS2769: No overload matches this call.
  Overload 1 of 2, '(error: Error, dirty: boolean, transpile?: boolean | undefined): void', gave the following error.
    Argument of type 'null' is not assignable to parameter of type 'Error'.
  Overload 2 of 2, '(error: Error, result: TransformResult): void', gave the following error.
    Argument of type 'null' is not assignable to parameter of type 'Error'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant