-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstore.ts
45 lines (40 loc) · 952 Bytes
/
store.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-unused-vars */
/**
* Internal dependencies
*/
import { store } from '../store';
describe( 'Interactivity API', () => {
it( 'needs at least one test', () => {
expect( true ).toBe( true );
} );
describe( 'static typing', () => {
( async () => {
const { actions } = store( 'test', {
actions: {
sync: () => 123,
*async() {
return 123;
},
},
} );
/**
* Test types.
*/
{
const var1: number = actions.sync();
const var2: Promise< number > = actions.async();
const var3: number = await actions.async();
}
{
// This is expected to fail.
// // @ts-expect-error
const var1: string = actions.sync();
// @ts-expect-error
const var2: Promise< string > = actions.async();
// @ts-expect-error
const var3: string = await actions.async();
}
} )();
} );
} );