Skip to content

Commit c1bea10

Browse files
authored
chore(jest-types): expose TransformedSource for transformers (#9736)
1 parent 3249385 commit c1bea10

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
### Chore & Maintenance
88

9+
- `[@jest/transform]` Expose type `TransformedSource` ([#9736](https://github.com/facebook/jest/pull/9736))
10+
911
### Performance
1012

1113
## 25.2.4
@@ -17,7 +19,7 @@
1719
### Fixes
1820

1921
- `[jest-circus]` Fix type elision of jest-runtime imports ([#9717](https://github.com/facebook/jest/pull/9717))
20-
- `[@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))
22+
- `[@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))
2123

2224
## 25.2.3
2325

packages/jest-transform/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export type {
1515
ShouldInstrumentOptions,
1616
Options as TransformationOptions,
1717
TransformResult,
18+
TransformedSource,
1819
} from './types';
1920
export {default as handlePotentialSyntaxError} from './enhanceUnexpectedTokenMessage';

packages/jest-transform/src/types.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ interface FixedRawSourceMap extends SourceMapWithVersion {
3232
version: number;
3333
}
3434

35-
export type TransformedSource = {
36-
code: string;
37-
map?: FixedRawSourceMap | string | null;
38-
};
35+
export type TransformedSource =
36+
| {code: string; map?: FixedRawSourceMap | string | null}
37+
| string;
3938

4039
export type TransformResult = {
4140
code: string;
@@ -70,5 +69,5 @@ export interface Transformer {
7069
sourcePath: Config.Path,
7170
config: Config.ProjectConfig,
7271
options?: TransformOptions,
73-
) => string | TransformedSource;
72+
) => TransformedSource;
7473
}

0 commit comments

Comments
 (0)