Skip to content

The comparability relationship is not documented in the spec #17214

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

Closed
DanielRosenwasser opened this issue Jul 14, 2017 · 0 comments
Closed

The comparability relationship is not documented in the spec #17214

DanielRosenwasser opened this issue Jul 14, 2017 · 0 comments
Assignees
Labels
Spec Issues related to the TypeScript language specification

Comments

@DanielRosenwasser
Copy link
Member

The comparability and assignment compatibility rules differ only in that

  • a union type is comparable to a target type if any of its constituents, rather than all of its constituents, are comparable to that target type,
  • whether a type is considered weak has no bearing on whether two types are comparable,
  • whether an object type has excess properties has no bearing on whether two types are comparable,
  • an object type with some optional property is comparable to an object type containing a property of the same name if it has a compatible type, regardless of whether that property is optional, and
  • when relating any two signatures, each signature is always instantiated using type Any for all type arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Spec Issues related to the TypeScript language specification
Projects
None yet
Development

No branches or pull requests

2 participants