You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I specify the second argument value explicitly, as in RematchRootState<RootModel, {}>, derived type expects all properties to have type never, instead of the actual types from the first "models" argument.
I was able to extract a simple case, based on my understanding of the codebase:
I would expect buildState() to type check.
Instead, I see the following error:
Type '{ prop: number; }' is not assignable to type 'MyRootState'.
Type '{ prop: number; }' is not assignable to type '{ [x: string]: never; }'.
Property 'prop' is incompatible with index signature.
Type 'number' is not assignable to type 'never'.
I've tried with different TSC versions, starting from version 4.1.5 and up to 4.7.4.
The text was updated successfully, but these errors were encountered:
Changing the default value of TExtraModels to Record<never, never> seems to fix the problem for me. Try it on TS Playground.
I wonder if this is a better default?
General description
RematchRootState
second argument default value ofRecord<string, never>
does not seem to work for me.It was changed in
Commit and line link: 0f3649e#diff-4c2458380e50c967c70d7afe819dc7412180f9f817043f27441de3498e4d0479R292
Unless I specify the second argument value explicitly, as in
RematchRootState<RootModel, {}>
, derived type expects all properties to have typenever
, instead of the actual types from the first "models" argument.I was able to extract a simple case, based on my understanding of the codebase:
Run the above on TS Playground with 4.7.4
Expected behavior
I would expect
buildState()
to type check.Instead, I see the following error:
I've tried with different TSC versions, starting from version 4.1.5 and up to 4.7.4.
The text was updated successfully, but these errors were encountered: