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
// A *self-contained* demonstration of the problem follows...// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
I want to give the user the ability to supply their own interface or default to a different structure:
TypeScript Version:
3.3.1
Search Terms:
conditional types default
Code
I want to give the user the ability to supply their own interface or default to a different structure:
So I have a State type argument that defaults to unknown. If it is unknown then it should be Config.
Everything works fine in this example of supplying your own State.
I get type safety if I change one of the types from the NodeState interface to be not a number, e.g.
But if I add a prop that is not part of the NodeState interface then this is not recognised as a break.
e.g.
Expected behavior:
fook
should be identified as not part of theNodeState
interfaceActual behavior:
No type error
Playground Link:
playground
Related Issues:
The text was updated successfully, but these errors were encountered: