Skip to content

Commit

Permalink
chore(jest-types): expose TransformedSource for transformers (#9736)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl committed Apr 1, 2020
1 parent 3249385 commit c1bea10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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;
}

0 comments on commit c1bea10

Please sign in to comment.