File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function expectType<T>(p: T): T {
19
19
}
20
20
21
21
/*
22
- * Test: PayloadAction type parameter is optional (defaults to `any`) .
22
+ * Test: PayloadAction type parameter is required .
23
23
*/
24
24
{
25
25
// typings:expect-error
@@ -61,12 +61,10 @@ function expectType<T>(p: T): T {
61
61
payload
62
62
} ) ,
63
63
{ type : 'action' }
64
- ) as PayloadActionCreator < number >
64
+ ) as PayloadActionCreator < number | undefined >
65
65
66
66
expectType < PayloadAction < number > > ( actionCreator ( 1 ) )
67
- // typings:expect-error
68
67
expectType < PayloadAction < undefined > > ( actionCreator ( ) )
69
- // typings:expect-error
70
68
expectType < PayloadAction < undefined > > ( actionCreator ( undefined ) )
71
69
72
70
// typings:expect-error
@@ -118,12 +116,9 @@ function expectType<T>(p: T): T {
118
116
* Test: createAction() type parameter is required, not inferred (defaults to `void`).
119
117
*/
120
118
{
121
- const increment = createAction < number > ( 'increment' )
122
- const n : number = increment ( 1 ) . payload
123
- // typings:expect-error
124
- const s : string = increment ( '1' ) . payload
119
+ const increment = createAction ( 'increment' )
125
120
// typings:expect-error
126
- const t : string = increment ( 1 ) . payload
121
+ const n : number = increment ( 1 ) . payload
127
122
}
128
123
/*
129
124
* Test: createAction().type is a string literal.
You can’t perform that action at this time.
0 commit comments