Closed
Description
Assignability Between {}
and Unconstrained Type Parameters
- When we added
unknown
, we also added a special case forunknown
to 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>
whereT
really 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,
unknown
and{}
are really the same thing. - Maybe that's why we kept the rule in the first place.
unknown
is 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
-
https://github.com/mattmccutchen/TypeScript/pull/1/files#diff-0e62d568d28b82cee9e66b2b8fafd290R7-R42
-
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment