-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Variance RelationshipsThe issue relates to variance relationships between typesThe issue relates to variance relationships between typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Description
π Search Terms
Variance
π Version & Regression Information
This is the behavior in every version I tried.
β― Playground Link
π» Code
interface DerivedTable<S extends { base: any; new: any }> {
// Error disappears when these property declarations are reversed
schema: S["base"] & S["new"]
readonlySchema: Readonly<S["base"] & S["new"]>
}
interface Base { baseProp: number; }
interface New { newProp: boolean; }
declare const source: DerivedTable<{ base: Base, new: New }>
const destination: DerivedTable<{ base: Base; new: New & Base }> = source; // Errorπ Actual behavior
Error.
π Expected behavior
No error.
Additional information about the issue
Investigation of cause here.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Variance RelationshipsThe issue relates to variance relationships between typesThe issue relates to variance relationships between typesFix AvailableA PR has been opened for this issueA PR has been opened for this issue