1
- import { expectType } from 'tsd-check' ;
2
- import writeJsonFile , { sync , Replacer , SortKeys , JSONStringifyable } from '.' ;
1
+ import { expectType } from 'tsd' ;
2
+ import writeJsonFile = require( '.' ) ;
3
+ import { sync , Replacer , SortKeys , JSONStringifyable } from '.' ;
3
4
4
5
expectType < JSONStringifyable > ( '🦄' ) ;
5
6
expectType < JSONStringifyable > ( 1 ) ;
@@ -23,18 +24,18 @@ expectType<Replacer>(() => () => 'foo');
23
24
expectType < Replacer > ( ( key : string ) => key . toUpperCase ( ) ) ;
24
25
expectType < Replacer > ( ( key : string , value : string ) => ( key + value ) . toUpperCase ( ) ) ;
25
26
26
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } ) ) ;
27
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , '🦄' ) ) ;
28
- expectType < void > ( await writeJsonFile ( 'date.json' , new Date ( ) ) ) ;
29
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { detectIndent : true } ) ) ;
30
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { indent : ' ' } ) ) ;
31
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { indent : 4 } ) ) ;
32
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { mode : 0o666 } ) ) ;
33
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { replacer : [ 'unicorn' , 1 ] } ) ) ;
34
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { replacer : ( ) => 'unicorn' } ) ) ;
35
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : ( ) => - 1 } ) ) ;
36
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : ( a : string , b : string ) => a . length - b . length } ) ) ;
37
- expectType < void > ( await writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : true } ) ) ;
27
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } ) ) ;
28
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , '🦄' ) ) ;
29
+ expectType < Promise < void > > ( writeJsonFile ( 'date.json' , new Date ( ) ) ) ;
30
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { detectIndent : true } ) ) ;
31
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { indent : ' ' } ) ) ;
32
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { indent : 4 } ) ) ;
33
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { mode : 0o666 } ) ) ;
34
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { replacer : [ 'unicorn' , 1 ] } ) ) ;
35
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { replacer : ( ) => 'unicorn' } ) ) ;
36
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : ( ) => - 1 } ) ) ;
37
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : ( a : string , b : string ) => a . length - b . length } ) ) ;
38
+ expectType < Promise < void > > ( writeJsonFile ( 'unicorn.json' , { unicorn : '🦄' } , { sortKeys : true } ) ) ;
38
39
39
40
expectType < void > ( sync ( 'unicorn.json' , { unicorn : '🦄' } ) ) ;
40
41
expectType < void > ( sync ( 'unicorn.json' , '🦄' ) ) ;
0 commit comments