File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed
packages/jest-cli/src/init Expand file tree Collapse file tree 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';
1515import generateConfigFile from './generateConfigFile' ;
1616import modifyPackageJson from './modifyPackageJson' ;
1717import defaultQuestions , { testScriptQuestion } from './questions' ;
18- import type { ProjectPackageJson } from './types' ;
18+ import type { ProjectPackageJson , PromptsResults } from './types' ;
1919
2020const {
2121 JEST_CONFIG_BASE_NAME ,
@@ -26,15 +26,6 @@ const {
2626 PACKAGE_JSON ,
2727} = constants ;
2828
29- type PromptsResults = {
30- useTypescript : boolean ;
31- clearMocks : boolean ;
32- coverage : boolean ;
33- coverageProvider : boolean ;
34- environment : boolean ;
35- scripts : boolean ;
36- } ;
37-
3829const getConfigFilename = ( ext : string ) => JEST_CONFIG_BASE_NAME + ext ;
3930
4031export default async function init (
@@ -101,12 +92,11 @@ export default async function init(
10192
10293 let promptAborted = false ;
10394
104- // @ts -expect-error: Return type cannot be object - faulty typings
105- const results : PromptsResults = await prompts ( questions , {
95+ const results = ( await prompts ( questions , {
10696 onCancel : ( ) => {
10797 promptAborted = true ;
10898 } ,
109- } ) ;
99+ } ) ) as PromptsResults ;
110100
111101 if ( promptAborted ) {
112102 console . log ( ) ;
Original file line number Diff line number Diff line change @@ -12,3 +12,12 @@ export type ProjectPackageJson = {
1212 scripts ?: Record < string , string > ;
1313 type ?: 'commonjs' | 'module' ;
1414} ;
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