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

Fix transformer signature in babel-jest #7945

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improved typing
  • Loading branch information
rubennorte committed Feb 21, 2019
commit a9bb970a06e6d5b9360a131ef7888f17908bac33
14 changes: 8 additions & 6 deletions packages/babel-jest/src/index.ts
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ const babelIstanbulPlugin = require.resolve('babel-plugin-istanbul');
// Narrow down the types
interface BabelJestTransformer extends Transformer {
canInstrument: true;
createTransformer?: (options?: TransformOptions) => BabelJestTransformer;
}

const createTransformer = (
@@ -132,10 +131,13 @@ const createTransformer = (
};
};

const transformer = createTransformer();

// Assigned here so only the exported transformer has `createTransformer`,
// instead of all created transformers by the function
transformer.createTransformer = createTransformer;
const transformer: BabelJestTransformer & {
createTransformer: (options?: TransformOptions) => BabelJestTransformer;
} = {
...createTransformer(),
// Assigned here so only the exported transformer has `createTransformer`,
// instead of all created transformers by the function
createTransformer,
};

export = transformer;