Skip to content

Commit c442388

Browse files
committed
provoke error
1 parent b0b9b8f commit c442388

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

packages/toolkit/src/createSlice.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export type ValidateSliceCaseReducers<
235235
? {
236236
prepare(...a: never[]): Omit<A, 'type'>
237237
}
238-
: ACR[T]
238+
: {}
239239
}
240240

241241
function getType(slice: string, actionKey: string): string {
@@ -268,8 +268,10 @@ export function createSlice<
268268
typeof process !== 'undefined' &&
269269
process.env.NODE_ENV === 'development'
270270
) {
271-
if(options.initialState === undefined) {
272-
console.error('You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`')
271+
if (options.initialState === undefined) {
272+
console.error(
273+
'You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`'
274+
)
273275
}
274276
}
275277

packages/toolkit/src/tests/createSlice.typetest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import type {
99
PayloadAction,
1010
SliceCaseReducers,
1111
ValidateSliceCaseReducers,
12-
} from '@reduxjs/toolkit'
13-
import { createAction, createSlice } from '@reduxjs/toolkit'
12+
} from '..'
13+
import { createAction, createSlice } from '..'
1414
import { expectType } from './helpers'
1515

1616
/*
@@ -58,7 +58,7 @@ const value = actionCreators.anyKey
5858
reducers: {
5959
increment: (state: number, action) => {
6060
// @ts-expect-error
61-
expect<string>(state)
61+
expectType<string>(state)
6262
return state + action.payload
6363
},
6464
decrement: (state: number, action) => state - action.payload,
@@ -101,7 +101,7 @@ const value = actionCreators.anyKey
101101
{ payload = 1 }: PayloadAction<number | undefined>
102102
) => {
103103
// @ts-expect-error
104-
expect<string>(state)
104+
expectType<string>(state)
105105
return state - payload
106106
},
107107

packages/toolkit/tsconfig.test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../toolkit/tsconfig.base.json",
2+
"extends": "./tsconfig.base.json",
33
"compilerOptions": {
44
"allowSyntheticDefaultImports": true,
55
"esModuleInterop": true,

0 commit comments

Comments
 (0)