This repository was archived by the owner on May 2, 2024. It is now read-only.
Commit eabcd4e 1 parent b32fde6 commit eabcd4e Copy full SHA for eabcd4e
File tree 3 files changed +59
-2
lines changed
3 files changed +59
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { Container } from "unstated" ;
2
+
3
+ declare const UNSTATED : {
4
+ /**
5
+ An object containing the project's containers.
6
+ */
7
+ containers : {
8
+ [ containerName : string ] : Container < { [ stateName : string ] : unknown } > ;
9
+ } ;
10
+
11
+ /**
12
+ Whether the debugger should be enabled or not.
13
+ */
14
+ isEnabled : boolean ;
15
+
16
+ /**
17
+ Function that logs out the current state.
18
+ */
19
+ logState : ( ) => void ;
20
+
21
+ /**
22
+ Boolean value that represents whether state changes should be logged to the
23
+ console.
24
+ */
25
+ logStateChanges : boolean ;
26
+
27
+ /**
28
+ An object containing all of the state values.
29
+ */
30
+ states : {
31
+ [ containerName : string ] : { [ stateName : string ] : unknown } ;
32
+ } ;
33
+ } ;
34
+
35
+ export default UNSTATED ;
Original file line number Diff line number Diff line change
1
+ import { expectType } from "tsd-check" ;
2
+ import UNSTATED from "./index" ;
3
+ import { Container } from "unstated" ;
4
+
5
+ expectType < boolean > ( UNSTATED . isEnabled ) ;
6
+ expectType < boolean > ( UNSTATED . logStateChanges ) ;
7
+
8
+ expectType < {
9
+ [ containerName : string ] : Container < { [ stateName : string ] : unknown } > ;
10
+ } > ( UNSTATED . containers ) ;
11
+
12
+ expectType < ( ) => void > ( UNSTATED . logState ) ;
13
+ expectType < void > ( UNSTATED . logState ( ) ) ;
14
+
15
+ expectType < { [ containerName : string ] : { [ stateName : string ] : unknown } } > (
16
+ UNSTATED . states
17
+ ) ;
Original file line number Diff line number Diff line change 13
13
"node" : " >=8"
14
14
},
15
15
"scripts" : {
16
- "test" : " xo && ava"
16
+ "test" : " xo && ava && tsd-check "
17
17
},
18
18
"files" : [
19
- " index.js"
19
+ " index.js" ,
20
+ " index.d.ts"
20
21
],
21
22
"keywords" : [
22
23
" unstated" ,
38
39
"ava" : " *" ,
39
40
"browser-env" : " ^3.2.5" ,
40
41
"react" : " ^16.3.0" ,
42
+ "tsd-check" : " ^0.6.0" ,
41
43
"unstated" : " ^2.0.2" ,
42
44
"xo" : " *"
43
45
},
48
50
"envs" : [
49
51
" node" ,
50
52
" browser"
53
+ ],
54
+ "ignores" : [
55
+ " *.ts"
51
56
]
52
57
},
53
58
"ava" : {
You can’t perform that action at this time.
0 commit comments