Skip to content

Commit c3cbe2e

Browse files
authored
fix: Declare "EmptyObject" interface to wrap $CombinedState (#4031)
1 parent 360b06f commit c3cbe2e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ declare const $CombinedState: unique symbol
5353
* typed as always undefined, so its never expected to have a meaningful
5454
* value anyway. It just makes this type distinquishable from plain `{}`.
5555
*/
56-
export type CombinedState<S> = { readonly [$CombinedState]?: undefined } & S
56+
interface EmptyObject {
57+
readonly [$CombinedState]?: undefined
58+
}
59+
export type CombinedState<S> = EmptyObject & S
5760

5861
/**
5962
* Recursively makes combined state objects partial. Only combined state _root
6063
* objects_ (i.e. the generated higher level object with keys mapping to
6164
* individual reducers) are partial.
6265
*/
63-
export type PreloadedState<S> = Required<S> extends {
64-
[$CombinedState]: undefined
65-
}
66+
export type PreloadedState<S> = Required<S> extends EmptyObject
6667
? S extends CombinedState<infer S1>
6768
? {
6869
[K in keyof S1]?: S1[K] extends object ? PreloadedState<S1[K]> : S1[K]

0 commit comments

Comments
 (0)