Skip to content

Commit ddb0e74

Browse files
authored
Revert "docs: add satisfies keyword with type assertion (#3623)"
This reverts commit e454251.
1 parent f63b862 commit ddb0e74

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

docs/api/autoBatchEnhancer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface CounterState {
2727

2828
const counterSlice = createSlice({
2929
name: 'counter',
30-
initialState: { value: 0 } satisfies CounterState as CounterState,
30+
initialState: { value: 0 } as CounterState,
3131
reducers: {
3232
incrementBatched: {
3333
// Batched, low-priority

docs/api/createReducer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const increment = createAction('counter/increment')
5454
const decrement = createAction('counter/decrement')
5555
const incrementByAmount = createAction<number>('counter/incrementByAmount')
5656

57-
const initialState = { value: 0 } satisfies CounterState as CounterState
57+
const initialState = { value: 0 } as CounterState
5858

5959
const counterReducer = createReducer(initialState, (builder) => {
6060
builder

docs/api/createSlice.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface CounterState {
2525
value: number
2626
}
2727

28-
const initialState = { value: 0 } satisfies CounterState as CounterState
28+
const initialState = { value: 0 } as CounterState
2929

3030
const counterSlice = createSlice({
3131
name: 'counter',

docs/tutorials/quick-start.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ export interface CounterState {
117117
value: number
118118
}
119119

120-
const initialState = { value: 0 } satisfies CounterState as CounterState
120+
const initialState: CounterState = {
121+
value: 0,
122+
}
121123

122124
export const counterSlice = createSlice({
123125
name: 'counter',

docs/tutorials/typescript.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ interface CounterState {
108108
}
109109

110110
// Define the initial state using that type
111-
const initialState = { value: 0 } satisfies CounterState as CounterState
111+
const initialState: CounterState = {
112+
value: 0,
113+
}
112114
// highlight-end
113115

114116
export const counterSlice = createSlice({
@@ -147,7 +149,7 @@ In some cases, [TypeScript may unnecessarily tighten the type of the initial sta
147149
// Workaround: cast state instead of declaring variable type
148150
const initialState = {
149151
value: 0,
150-
} satisfies CounterState as CounterState
152+
} as CounterState
151153
```
152154

153155
### Use Typed Hooks in Components

docs/usage/usage-with-typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ createSlice({
326326
// Or, cast the initial state as necessary
327327
createSlice({
328328
name: 'test2',
329-
initialState: { state: 'loading' } satisfies SliceState as SliceState,
329+
initialState: { state: 'loading' } as SliceState,
330330
reducers: {},
331331
})
332332
```

0 commit comments

Comments
 (0)