website icon indicating copy to clipboard operation
website copied to clipboard

@swc/jest: Config snippet does not pass TSC

Open simonhammes opened this issue 3 years ago • 0 comments

The following config snippet from the docs does not pass TSC (after renaming the config file to .ts and adding type annotations):

module.exports = {
  transform: {
    "^.+\\.(t|j)sx?$": ["@swc/jest"],
  },
};

TSC:

TSError: ⨯ Unable to compile TypeScript:
jest.config.ts:14:3 - error TS2322: Type '[string]' is not assignable to type 'string | TransformerConfig'.
  Type '[string]' is not assignable to type 'string'.

'^.+\\.(t|j)sx?$': [ '@swc/jest' ],

I think it should be either @swc/jest as a plain string or [ '@swc/jest', {} ] with an empty record.

simonhammes avatar Jun 16 '22 09:06 simonhammes