Skip to content

The comparability relationship is not documented in the spec #17214

Closed

Description

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.

Metadata

Metadata

Labels

SpecIssues related to the TypeScript language specification

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions