@@ -2,43 +2,46 @@ import {expectAssignable, expectType} from 'tsd';
22import { PackageJson } from 'type-fest' ;
33import meow , { Result } from './index.js' ;
44
5+ const importMeta = import . meta;
6+
57expectType < Result < never > > ( meow ( 'Help text' ) ) ;
6- expectType < Result < never > > ( meow ( 'Help text' , { hardRejection : false } ) ) ;
8+ expectType < Result < never > > ( meow ( 'Help text' , { importMeta , hardRejection : false } ) ) ;
79expectAssignable < { flags : { foo : number } } > (
8- meow ( { flags : { foo : { type : 'number' , isRequired : true } } } )
10+ meow ( { importMeta : import . meta , flags : { foo : { type : 'number' , isRequired : true } } } )
911) ;
1012expectAssignable < { flags : { foo : string } } > (
11- meow ( { flags : { foo : { type : 'string' , isRequired : true } } } )
13+ meow ( { importMeta , flags : { foo : { type : 'string' , isRequired : true } } } )
1214) ;
1315expectAssignable < { flags : { foo : boolean } } > (
14- meow ( { flags : { foo : { type : 'boolean' , isRequired : true } } } )
16+ meow ( { importMeta , flags : { foo : { type : 'boolean' , isRequired : true } } } )
1517) ;
1618expectAssignable < { flags : { foo : number | undefined } } > (
17- meow ( { flags : { foo : { type : 'number' } } } )
19+ meow ( { importMeta , flags : { foo : { type : 'number' } } } )
1820) ;
1921expectAssignable < { flags : { foo : string | undefined } } > (
20- meow ( { flags : { foo : { type : 'string' } } } )
22+ meow ( { importMeta , flags : { foo : { type : 'string' } } } )
2123) ;
2224expectAssignable < { flags : { foo : boolean | undefined } } > (
23- meow ( { flags : { foo : { type : 'boolean' } } } )
25+ meow ( { importMeta , flags : { foo : { type : 'boolean' } } } )
2426) ;
25- expectType < Result < never > > ( meow ( { description : 'foo' } ) ) ;
26- expectType < Result < never > > ( meow ( { description : false } ) ) ;
27- expectType < Result < never > > ( meow ( { help : 'foo' } ) ) ;
28- expectType < Result < never > > ( meow ( { help : false } ) ) ;
29- expectType < Result < never > > ( meow ( { version : 'foo' } ) ) ;
30- expectType < Result < never > > ( meow ( { version : false } ) ) ;
31- expectType < Result < never > > ( meow ( { autoHelp : false } ) ) ;
32- expectType < Result < never > > ( meow ( { autoVersion : false } ) ) ;
33- expectType < Result < never > > ( meow ( { pkg : { foo : 'bar' } } ) ) ;
34- expectType < Result < never > > ( meow ( { argv : [ 'foo' , 'bar' ] } ) ) ;
35- expectType < Result < never > > ( meow ( { inferType : true } ) ) ;
36- expectType < Result < never > > ( meow ( { booleanDefault : true } ) ) ;
37- expectType < Result < never > > ( meow ( { booleanDefault : null } ) ) ;
38- expectType < Result < never > > ( meow ( { booleanDefault : undefined } ) ) ;
39- expectType < Result < never > > ( meow ( { hardRejection : false } ) ) ;
27+ expectType < Result < never > > ( meow ( { importMeta , description : 'foo' } ) ) ;
28+ expectType < Result < never > > ( meow ( { importMeta , description : false } ) ) ;
29+ expectType < Result < never > > ( meow ( { importMeta , help : 'foo' } ) ) ;
30+ expectType < Result < never > > ( meow ( { importMeta , help : false } ) ) ;
31+ expectType < Result < never > > ( meow ( { importMeta , version : 'foo' } ) ) ;
32+ expectType < Result < never > > ( meow ( { importMeta , version : false } ) ) ;
33+ expectType < Result < never > > ( meow ( { importMeta , autoHelp : false } ) ) ;
34+ expectType < Result < never > > ( meow ( { importMeta , autoVersion : false } ) ) ;
35+ expectType < Result < never > > ( meow ( { importMeta , pkg : { foo : 'bar' } } ) ) ;
36+ expectType < Result < never > > ( meow ( { importMeta , argv : [ 'foo' , 'bar' ] } ) ) ;
37+ expectType < Result < never > > ( meow ( { importMeta , inferType : true } ) ) ;
38+ expectType < Result < never > > ( meow ( { importMeta , booleanDefault : true } ) ) ;
39+ expectType < Result < never > > ( meow ( { importMeta , booleanDefault : null } ) ) ;
40+ expectType < Result < never > > ( meow ( { importMeta , booleanDefault : undefined } ) ) ;
41+ expectType < Result < never > > ( meow ( { importMeta , hardRejection : false } ) ) ;
4042
4143const result = meow ( 'Help text' , {
44+ importMeta,
4245 flags : {
4346 foo : { type : 'boolean' , alias : 'f' } ,
4447 'foo-bar' : { type : 'number' } ,
@@ -66,6 +69,7 @@ result.showHelp(1);
6669result . showVersion ( ) ;
6770
6871const options = {
72+ importMeta,
6973 flags : {
7074 rainbow : {
7175 type : 'boolean' ,
0 commit comments