-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Design NotesNotes from our design meetingsNotes from our design meetings
Description
Assignability Between {} and Unconstrained Type Parameters
- When we added
unknown, we also added a special case forunknownto be assignable to{}andObject. - A while back, we changed the default type parameter constraint of
{}tounknown - This actually broke us as well!
- A couple of places where we mixed and matched between
{}andunknown.
- A couple of places where we mixed and matched between
- Lots of failures, but mostly failures in the same package.
schema<T>whereTreally should've been updated to{}.
- Does this break type parameters that explicitly extend
{}?- No, there's no special casing for type parameters.
- Is it pretty easy to fix?
- Pretty consistent that people just have to change the constraints to only accept
{}orobject.
- Pretty consistent that people just have to change the constraints to only accept
- Not such a big fan of more breaks in the same release.
- But the error messages are consistent around
{}.
- But the error messages are consistent around
- What about when you're not in strict mode?
- There,
unknownand{}are really the same thing. - Maybe that's why we kept the rule in the first place.
unknownis already assignable to{}outside ofstrictNullChecks, so this doesn't affect users there.
- There,
- Who'd it break?
- DefinitelyTyped
- Office UI Fabric
- Seems to be from DefinitelyTyped changes
- Conclusion
- Try to see whether we can at least give an actionable error on this change.
- Let's hold it off for another release.
Update on Intersection Assignability with Optional Properties
- Office UI Fabric got hit, gave them an update.
Checking Index Signatures In the Presence of Optional Properties
-
Is debatable - doesn't mean that all the properties are there
- Depends on the intent
-
Definitely catches bad code!
- Breaks VS Code and Azure, but these are correct breaks!
-
Delay this for the next release.
-
Lets give known broken partner teams a heads up
- @weswigham to tarball this
- @sandersn reach out to VS Code
- @DanielRosenwasser reach to Azure SDK
Metadata
Metadata
Assignees
Labels
Design NotesNotes from our design meetingsNotes from our design meetings