File tree 2 files changed +12
-13
lines changed
packages/jest-cli/src/init
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {MalformedPackageJsonError, NotFoundPackageJsonError} from './errors';
15
15
import generateConfigFile from './generateConfigFile' ;
16
16
import modifyPackageJson from './modifyPackageJson' ;
17
17
import defaultQuestions , { testScriptQuestion } from './questions' ;
18
- import type { ProjectPackageJson } from './types' ;
18
+ import type { ProjectPackageJson , PromptsResults } from './types' ;
19
19
20
20
const {
21
21
JEST_CONFIG_BASE_NAME ,
@@ -26,15 +26,6 @@ const {
26
26
PACKAGE_JSON ,
27
27
} = constants ;
28
28
29
- type PromptsResults = {
30
- useTypescript : boolean ;
31
- clearMocks : boolean ;
32
- coverage : boolean ;
33
- coverageProvider : boolean ;
34
- environment : boolean ;
35
- scripts : boolean ;
36
- } ;
37
-
38
29
const getConfigFilename = ( ext : string ) => JEST_CONFIG_BASE_NAME + ext ;
39
30
40
31
export default async function init (
@@ -101,12 +92,11 @@ export default async function init(
101
92
102
93
let promptAborted = false ;
103
94
104
- // @ts -expect-error: Return type cannot be object - faulty typings
105
- const results : PromptsResults = await prompts ( questions , {
95
+ const results = ( await prompts ( questions , {
106
96
onCancel : ( ) => {
107
97
promptAborted = true ;
108
98
} ,
109
- } ) ;
99
+ } ) ) as PromptsResults ;
110
100
111
101
if ( promptAborted ) {
112
102
console . log ( ) ;
Original file line number Diff line number Diff line change @@ -12,3 +12,12 @@ export type ProjectPackageJson = {
12
12
scripts ?: Record < string , string > ;
13
13
type ?: 'commonjs' | 'module' ;
14
14
} ;
15
+
16
+ export type PromptsResults = {
17
+ useTypescript : boolean ;
18
+ clearMocks : boolean ;
19
+ coverage : boolean ;
20
+ coverageProvider : boolean ;
21
+ environment : boolean ;
22
+ scripts : boolean ;
23
+ } ;
You can’t perform that action at this time.
0 commit comments