Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

T should be assignable to A extends B ? C : D if it is assignable to both C and D #26933

Copy link
Copy link
@mattmccutchen

Description

@mattmccutchen
Issue body actions

Search Terms

conditional assignable both

Suggestion

A type T should be assignable to A extends B ? C : D if it is assignable to both C and D. Previously mentioned here and here, but it doesn't appear that anyone ever filed an issue to track this.

It's unclear what to do if C references infer type parameters, but even an assignability rule that works only when C does not reference infer type parameters would be useful.

If the conditional type is distributive, then the rule only applies if A is known not to be never.

Use Cases

See this comment for one.

Examples

TBD

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueA PR has been opened for this issueInvestigatingIs in active investigationIs in active investigationSuggestionAn idea for TypeScriptAn idea for TypeScript

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.