From c69c61f5b73627222848bec3676b20b4f20cf714 Mon Sep 17 00:00:00 2001 From: Chang Cao Date: Thu, 15 Sep 2022 19:56:05 +0800 Subject: [PATCH] fix: mark `ts-jest` as optional in `ConfigGlobals` --- e2e/config-typing/jest.config.ts | 5 ++++- src/types.ts | 11 ++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e/config-typing/jest.config.ts b/e2e/config-typing/jest.config.ts index 832d5ffe4e..3590e663e6 100644 --- a/e2e/config-typing/jest.config.ts +++ b/e2e/config-typing/jest.config.ts @@ -1,4 +1,4 @@ -import type { JestConfigWithTsJest } from '../../dist' +import { type JestConfigWithTsJest } from '../../dist' const jestCfg: JestConfigWithTsJest = { transform: { @@ -9,6 +9,9 @@ const jestCfg: JestConfigWithTsJest = { }, ], }, + globals: { + aaa: true, + }, } export default jestCfg diff --git a/src/types.ts b/src/types.ts index 14ae3948b9..b99d434f6f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -17,7 +17,7 @@ declare module '@jest/types' { */ // eslint-disable-next-line // @ts-ignore - 'ts-jest': TsJestGlobalOptions + 'ts-jest'?: TsJestGlobalOptions } } } @@ -184,7 +184,7 @@ export interface TransformOptionsTsJest extends TransformOptions { * @deprecated use `JestConfigWithTsJest` instead */ export interface GlobalConfigTsJest extends Config.ConfigGlobals { - 'ts-jest': TsJestGlobalOptions + 'ts-jest'?: TsJestGlobalOptions } /** * @deprecated use `JestConfigWithTsJest` instead @@ -193,16 +193,13 @@ export interface InitialOptionsTsJest extends Config.InitialOptions { globals?: GlobalConfigTsJest } type TsJestTransformerOptions = TsJestGlobalOptions -export interface JestConfigWithTsJest extends Partial> { - transform: { +export interface JestConfigWithTsJest extends Omit { + transform?: { [regex: string]: 'ts-jest' | ['ts-jest', TsJestTransformerOptions] | string | [string, Record] } } export type StringMap = Map -/** - * @internal - */ export interface DepGraphInfo { fileContent: string resolvedModuleNames: string[]