Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: DeepPartial breaks when using unknown #3368

Closed
OliverJAsh opened this issue Mar 8, 2019 · 0 comments
Closed

TypeScript: DeepPartial breaks when using unknown #3368

OliverJAsh opened this issue Mar 8, 2019 · 0 comments

Comments

@OliverJAsh
Copy link
Contributor

Repro:

type State = {
  bar: unknown;
};

declare let preloadedState: State;

declare const reducer: Reducer<State>;
createStore(
  reducer,
  // Unexpected type error:
  /* Argument of type 'State' is not assignable to parameter of type 'DeepPartial<State>'.
  Types of property 'bar' are incompatible.
    Type 'unknown' is not assignable to type 'DeepPartial<unknown> | undefined'.
      Type 'unknown' is not assignable to type 'DeepPartial<unknown>'. */
  preloadedState,
);

type StateDP = DeepPartial<State>;
declare let stateDP: StateDP;
// Unexpected type error:
// Type 'State' is not assignable to type 'DeepPartial<State>'
stateDP = preloadedState;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant