Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e12b004

Browse files
authoredFeb 9, 2021
feat(presets): add typing for presets entry point (#2341)
1 parent f4f5d32 commit e12b004

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed
 

‎.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ e2e/__workdir_synlink__/
55
e2e/__external-repos__/
66
coverage/
77
docs/
8+
presets/index.d.ts
89
*.config.js
910
.eslintrc.js

‎presets/index.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { TsJestPresets } from '../dist/types'
2+
3+
declare const _default: {
4+
defaults: TsJestPresets;
5+
jsWithTs: TsJestPresets;
6+
jsWithBabel: TsJestPresets;
7+
};
8+
export = _default;

‎src/cli/helpers/presets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TsJestPresets } from '../../presets/create-jest-preset'
1+
import type { TsJestPresets } from '../../types'
22

33
/** @internal */
44
export const enum JestPresetNames {

‎src/presets/create-jest-preset.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import type { Config } from '@jest/types'
22

3+
import type { TsJestPresets } from '../types'
34
import { rootLogger } from '../utils/logger'
45

56
const logger = rootLogger.child({ namespace: 'jest-preset' })
67

7-
export type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>
8-
98
interface CreateJestPresetOptions {
109
allowJs?: boolean
1110
}

‎src/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ export interface InitialOptionsTsJest extends Config.InitialOptions {
162162
globals?: GlobalConfigTsJest
163163
}
164164

165+
export type TsJestPresets = Pick<Config.InitialOptions, 'moduleFileExtensions' | 'transform' | 'testMatch'>
166+
165167
interface TsJestConfig$tsConfig$file {
166168
kind: 'file'
167169
value: string | undefined

0 commit comments

Comments
 (0)
Please sign in to comment.