Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _submodules/TypeScript
Submodule TypeScript updated 44 files
+1 −1 .github/workflows/ci.yml
+80 −34 src/compiler/checker.ts
+6 −6 tests/baselines/reference/arrayAssignmentTest1.errors.txt
+2 −2 tests/baselines/reference/assignmentCompatWithCallSignatures3.errors.txt
+2 −2 tests/baselines/reference/assignmentCompatWithConstructSignatures3.errors.txt
+4 −4 tests/baselines/reference/assignmentCompatWithNumericIndexer.errors.txt
+4 −4 tests/baselines/reference/assignmentCompatWithNumericIndexer2.errors.txt
+6 −6 tests/baselines/reference/assignmentCompatWithStringIndexer.errors.txt
+6 −6 tests/baselines/reference/assignmentCompatWithStringIndexer2.errors.txt
+2 −2 tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt
+1 −1 tests/baselines/reference/checkJsxChildrenCanBeTupleType.types
+3 −0 tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types
+1 −1 tests/baselines/reference/contextuallyTypedJsxChildren.types
+2 −2 tests/baselines/reference/emitClassExpressionInDeclarationFile.js
+2 −2 tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates.errors.txt
+2 −2 tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.errors.txt
+1 −1 tests/baselines/reference/intraExpressionInferencesJsx.types
+2 −2 tests/baselines/reference/invalidReturnStatements.errors.txt
+2 −2 tests/baselines/reference/jsdocTypeTagCast.errors.txt
+1 −1 tests/baselines/reference/jsxCallElaborationCheckNoCrash1.types
+1 −1 tests/baselines/reference/jsxChildrenIndividualErrorElaborations.types
+1 −1 tests/baselines/reference/jsxComplexSignatureHasApplicabilityError.types
+1 −1 tests/baselines/reference/jsxElementType.types
+1 −1 tests/baselines/reference/jsxElementTypeLiteralWithGeneric.types
+1 −1 tests/baselines/reference/jsxExcessPropsAndAssignability.types
+1 −1 tests/baselines/reference/jsxIntrinsicElementsCompatability.types
+1 −1 tests/baselines/reference/jsxJsxsCjsTransformNestedSelfClosingChild(jsx=react-jsx).types
+1 −1 tests/baselines/reference/jsxJsxsCjsTransformNestedSelfClosingChild(jsx=react-jsxdev).types
+1 −1 tests/baselines/reference/parenthesizedJSDocCastAtReturnStatement.types
+105 −105 tests/baselines/reference/quickinfoVerbosityClass1.baseline
+269 −269 tests/baselines/reference/quickinfoVerbosityInterface1.baseline
+1 −1 tests/baselines/reference/reactHOCSpreadprops.types
+1 −1 tests/baselines/reference/reactReadonlyHOCAssignabilityReal.types
+1 −1 tests/baselines/reference/returnConditionalExpressionJSDocCast.types
+1 −1 tests/baselines/reference/returnTypePredicateIsInstantiateInContextOfTarget.types
+1 −1 tests/baselines/reference/tsxInvokeComponentType.types
+1 −1 tests/baselines/reference/tsxNotUsingApparentTypeOfSFC.types
+1 −1 tests/baselines/reference/tsxReactPropsInferenceSucceedsOnIntersections.types
+2 −2 tests/baselines/reference/typeAssertions.errors.txt
+1 −1 tests/baselines/reference/typeInferenceWithExcessPropertiesJsx.types
+50 −0 tests/baselines/reference/variancePropagation.symbols
+45 −0 tests/baselines/reference/variancePropagation.types
+16 −0 tests/cases/compiler/variancePropagation.ts
+1 −1 tests/cases/fourslash/codefixClassImplementInterface_omit.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,4 @@
+ tags(c: any): any;
};
};
export declare class FooItem {
@@= skipped -10, +10 lines =@@
export type Constructor<T> = new (...args: any[]) => T;
export declare function WithTags<T extends Constructor<FooItem>>(Base: T): {
new (...args: any[]): {
+ tags(): void;
foo(): void;
name?: string;
- tags(): void;
};
getTags(): void;
} & T;
declare const Test_base: {
new (...args: any[]): {
+ tags(): void;
foo(): void;
name?: string;
- tags(): void;
};
getTags(): void;
} & typeof FooItem;
export declare class FooItem {
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variancePropagation.ts(13,7): error TS2322: Type 'DerivedTable<{ base: Base; new: New; }>' is not assignable to type 'DerivedTable<{ base: Base; new: New & Base; }>'.
Type '{ base: Base; new: New; }' is not assignable to type '{ base: Base; new: New & Base; }'.
Types of property 'new' are incompatible.
Type 'New' is not assignable to type 'New & Base'.
Property 'baseProp' is missing in type 'New' but required in type 'Base'.


==== variancePropagation.ts (1 errors) ====
// https://github.com/microsoft/TypeScript/issues/62606

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
~~~~~~~~~~~
!!! error TS2322: Type 'DerivedTable<{ base: Base; new: New; }>' is not assignable to type 'DerivedTable<{ base: Base; new: New & Base; }>'.
!!! error TS2322: Type '{ base: Base; new: New; }' is not assignable to type '{ base: Base; new: New & Base; }'.
!!! error TS2322: Types of property 'new' are incompatible.
!!! error TS2322: Type 'New' is not assignable to type 'New & Base'.
!!! error TS2322: Property 'baseProp' is missing in type 'New' but required in type 'Base'.
!!! related TS2728 variancePropagation.ts:9:18: 'baseProp' is declared here.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- old.variancePropagation.errors.txt
+++ new.variancePropagation.errors.txt
@@= skipped -0, +0 lines =@@
-<no content>
+variancePropagation.ts(13,7): error TS2322: Type 'DerivedTable<{ base: Base; new: New; }>' is not assignable to type 'DerivedTable<{ base: Base; new: New & Base; }>'.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error will go away in #1916.

+ Type '{ base: Base; new: New; }' is not assignable to type '{ base: Base; new: New & Base; }'.
+ Types of property 'new' are incompatible.
+ Type 'New' is not assignable to type 'New & Base'.
+ Property 'baseProp' is missing in type 'New' but required in type 'Base'.
+
+
+==== variancePropagation.ts (1 errors) ====
+ // https://github.com/microsoft/TypeScript/issues/62606
+
+ 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
+ ~~~~~~~~~~~
+!!! error TS2322: Type 'DerivedTable<{ base: Base; new: New; }>' is not assignable to type 'DerivedTable<{ base: Base; new: New & Base; }>'.
+!!! error TS2322: Type '{ base: Base; new: New; }' is not assignable to type '{ base: Base; new: New & Base; }'.
+!!! error TS2322: Types of property 'new' are incompatible.
+!!! error TS2322: Type 'New' is not assignable to type 'New & Base'.
+!!! error TS2322: Property 'baseProp' is missing in type 'New' but required in type 'Base'.
+!!! related TS2728 variancePropagation.ts:9:18: 'baseProp' is declared here.
+
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//// [tests/cases/compiler/variancePropagation.ts] ////

=== variancePropagation.ts ===
// https://github.com/microsoft/TypeScript/issues/62606

interface DerivedTable<S extends { base: any; new: any }> {
>DerivedTable : Symbol(DerivedTable, Decl(variancePropagation.ts, 0, 0))
>S : Symbol(S, Decl(variancePropagation.ts, 2, 23))
>base : Symbol(base, Decl(variancePropagation.ts, 2, 34))
>new : Symbol(new, Decl(variancePropagation.ts, 2, 45))

// Error disappears when these property declarations are reversed
schema: S["base"] & S["new"]
>schema : Symbol(DerivedTable.schema, Decl(variancePropagation.ts, 2, 59))
>S : Symbol(S, Decl(variancePropagation.ts, 2, 23))
>S : Symbol(S, Decl(variancePropagation.ts, 2, 23))

readonlySchema: Readonly<S["base"] & S["new"]>
>readonlySchema : Symbol(DerivedTable.readonlySchema, Decl(variancePropagation.ts, 4, 32))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>S : Symbol(S, Decl(variancePropagation.ts, 2, 23))
>S : Symbol(S, Decl(variancePropagation.ts, 2, 23))
}

interface Base { baseProp: number; }
>Base : Symbol(Base, Decl(variancePropagation.ts, 6, 1))
>baseProp : Symbol(Base.baseProp, Decl(variancePropagation.ts, 8, 16))

interface New { newProp: boolean; }
>New : Symbol(New, Decl(variancePropagation.ts, 8, 36))
>newProp : Symbol(New.newProp, Decl(variancePropagation.ts, 9, 16))

declare const source: DerivedTable<{ base: Base, new: New }>
>source : Symbol(source, Decl(variancePropagation.ts, 11, 13))
>DerivedTable : Symbol(DerivedTable, Decl(variancePropagation.ts, 0, 0))
>base : Symbol(base, Decl(variancePropagation.ts, 11, 36))
>Base : Symbol(Base, Decl(variancePropagation.ts, 6, 1))
>new : Symbol(new, Decl(variancePropagation.ts, 11, 48))
>New : Symbol(New, Decl(variancePropagation.ts, 8, 36))

const destination: DerivedTable<{ base: Base; new: New & Base }> = source; // Error
>destination : Symbol(destination, Decl(variancePropagation.ts, 12, 5))
>DerivedTable : Symbol(DerivedTable, Decl(variancePropagation.ts, 0, 0))
>base : Symbol(base, Decl(variancePropagation.ts, 12, 33))
>Base : Symbol(Base, Decl(variancePropagation.ts, 6, 1))
>new : Symbol(new, Decl(variancePropagation.ts, 12, 45))
>New : Symbol(New, Decl(variancePropagation.ts, 8, 36))
>Base : Symbol(Base, Decl(variancePropagation.ts, 6, 1))
>source : Symbol(source, Decl(variancePropagation.ts, 11, 13))

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//// [tests/cases/compiler/variancePropagation.ts] ////

=== variancePropagation.ts ===
// https://github.com/microsoft/TypeScript/issues/62606

interface DerivedTable<S extends { base: any; new: any }> {
>base : any
>new : any

// Error disappears when these property declarations are reversed
schema: S["base"] & S["new"]
>schema : S["base"] & S["new"]

readonlySchema: Readonly<S["base"] & S["new"]>
>readonlySchema : Readonly<S["base"] & S["new"]>
}

interface Base { baseProp: number; }
>baseProp : number

interface New { newProp: boolean; }
>newProp : boolean

declare const source: DerivedTable<{ base: Base, new: New }>
>source : DerivedTable<{ base: Base; new: New; }>
>base : Base
>new : New

const destination: DerivedTable<{ base: Base; new: New & Base }> = source; // Error
>destination : DerivedTable<{ base: Base; new: New & Base; }>
>base : Base
>new : New & Base
>source : DerivedTable<{ base: Base; new: New; }>

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
Types of parameters 'y' and 'y' are incompatible.
Type 'T' is not assignable to type 'Derived2[]'.
Type 'Base[]' is not assignable to type 'Derived2[]'.
- Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
-assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '<T extends Array<Derived>>(x: Base[], y: T) => T'.
+ Type 'Base' is missing the following properties from type 'Derived2': baz, bar
+assignmentCompatWithCallSignatures3.ts(83,1): error TS2322: Type '(x: Base[], y: Derived[]) => Derived[]' is not assignable to type '<T extends Derived[]>(x: Base[], y: T) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'.
Expand All @@ -25,9 +24,7 @@
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'.
-!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
+!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b13: <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
@@= skipped -9, +9 lines =@@
a13 = b13; // ok
b13 = a13; // ok
~~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
Types of parameters 'y' and 'y' are incompatible.
Type 'T' is not assignable to type 'Derived2[]'.
Type 'Base[]' is not assignable to type 'Derived2[]'.
- Type 'Base' is missing the following properties from type 'Derived2': bar, baz
Type 'Base' is missing the following properties from type 'Derived2': baz, bar
-assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new <T extends Array<Derived>>(x: Base[], y: T) => T'.
+ Type 'Base' is missing the following properties from type 'Derived2': baz, bar
+assignmentCompatWithConstructSignatures3.ts(83,1): error TS2322: Type 'new (x: Base[], y: Derived[]) => Derived[]' is not assignable to type 'new <T extends Derived[]>(x: Base[], y: T) => T'.
Type 'Derived[]' is not assignable to type 'T'.
'Derived[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'Derived[]'.
Expand All @@ -25,9 +24,7 @@
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
!!! error TS2322: Type 'T' is not assignable to type 'Derived2[]'.
!!! error TS2322: Type 'Base[]' is not assignable to type 'Derived2[]'.
-!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': bar, baz
+!!! error TS2322: Type 'Base' is missing the following properties from type 'Derived2': baz, bar
var b13: new <T extends Array<Derived>>(x: Array<Base>, y: T) => T;
@@= skipped -9, +9 lines =@@
a13 = b13; // ok
b13 = a13; // ok
~~~
Expand Down

This file was deleted.

Loading
Loading