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

chore(jest-types): expose TransformedSource for transformers #9736

Merged
merged 2 commits into from Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@

### Chore & Maintenance

- `[@jest/transform]` Expose type `TransformedSource` ([#9736](https://github.com/facebook/jest/pull/9736))

### Performance

## 25.2.4
Expand All @@ -17,7 +19,7 @@
### Fixes

- `[jest-circus]` Fix type elision of jest-runtime imports ([#9717](https://github.com/facebook/jest/pull/9717))
- `[@jest/transform]` Fix coverage reporter for uncovered files without transformers, reverting ([#9460](https://github.com/facebook/jest/pull/9460)) ([#9724](https://github.com/facebook/jest/pull/9724))
- `[@jest/transform]` Fix coverage reporter for uncovered files without transformers, reverting [#9460](https://github.com/facebook/jest/pull/9460) ([#9724](https://github.com/facebook/jest/pull/9724))

## 25.2.3

Expand Down
1 change: 1 addition & 0 deletions packages/jest-transform/src/index.ts
Expand Up @@ -15,5 +15,6 @@ export type {
ShouldInstrumentOptions,
Options as TransformationOptions,
TransformResult,
TransformedSource,
} from './types';
export {default as handlePotentialSyntaxError} from './enhanceUnexpectedTokenMessage';
9 changes: 4 additions & 5 deletions packages/jest-transform/src/types.ts
Expand Up @@ -32,10 +32,9 @@ interface FixedRawSourceMap extends SourceMapWithVersion {
version: number;
}

export type TransformedSource = {
code: string;
map?: FixedRawSourceMap | string | null;
};
export type TransformedSource =
| {code: string; map?: FixedRawSourceMap | string | null}
| string;

export type TransformResult = {
code: string;
Expand Down Expand Up @@ -70,5 +69,5 @@ export interface Transformer {
sourcePath: Config.Path,
config: Config.ProjectConfig,
options?: TransformOptions,
) => string | TransformedSource;
) => TransformedSource;
}