-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Component commits: 2e0b451 Add isIntersectionConstituent to relation key isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. #33133 provides an example of such a program. Fixes #33133 the right way, so I reverted the fix at #33213 Fixes #34762 (by reverting #33213) Fixes #33944 -- I added the test from #34646 14d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key ea80362 Update comments in test 0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
- Loading branch information
Showing
14 changed files
with
209 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/commonTypeIntersection.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
tests/cases/conformance/types/intersection/commonTypeIntersection.ts(2,5): error TS2322: Type '{ __typename?: "TypeTwo"; } & { a: boolean; }' is not assignable to type '{ __typename?: "TypeOne"; } & { a: boolean; }'. | ||
Type '{ __typename?: "TypeTwo"; } & { a: boolean; }' is not assignable to type '{ __typename?: "TypeOne"; }'. | ||
Types of property '__typename' are incompatible. | ||
Type '"TypeTwo"' is not assignable to type '"TypeOne"'. | ||
tests/cases/conformance/types/intersection/commonTypeIntersection.ts(4,5): error TS2322: Type '{ __typename?: "TypeTwo"; } & string' is not assignable to type '{ __typename?: "TypeOne"; } & string'. | ||
Type '{ __typename?: "TypeTwo"; } & string' is not assignable to type '{ __typename?: "TypeOne"; }'. | ||
Types of property '__typename' are incompatible. | ||
Type '"TypeTwo"' is not assignable to type '"TypeOne"'. | ||
|
||
|
||
==== tests/cases/conformance/types/intersection/commonTypeIntersection.ts (2 errors) ==== | ||
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean }; | ||
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here | ||
~~ | ||
!!! error TS2322: Type '{ __typename?: "TypeTwo"; } & { a: boolean; }' is not assignable to type '{ __typename?: "TypeOne"; } & { a: boolean; }'. | ||
!!! error TS2322: Type '{ __typename?: "TypeTwo"; } & { a: boolean; }' is not assignable to type '{ __typename?: "TypeOne"; }'. | ||
!!! error TS2322: Types of property '__typename' are incompatible. | ||
!!! error TS2322: Type '"TypeTwo"' is not assignable to type '"TypeOne"'. | ||
declare let x2: { __typename?: 'TypeTwo' } & string; | ||
let y2: { __typename?: 'TypeOne' } & string = x2; // should error here | ||
~~ | ||
!!! error TS2322: Type '{ __typename?: "TypeTwo"; } & string' is not assignable to type '{ __typename?: "TypeOne"; } & string'. | ||
!!! error TS2322: Type '{ __typename?: "TypeTwo"; } & string' is not assignable to type '{ __typename?: "TypeOne"; }'. | ||
!!! error TS2322: Types of property '__typename' are incompatible. | ||
!!! error TS2322: Type '"TypeTwo"' is not assignable to type '"TypeOne"'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//// [commonTypeIntersection.ts] | ||
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean }; | ||
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here | ||
declare let x2: { __typename?: 'TypeTwo' } & string; | ||
let y2: { __typename?: 'TypeOne' } & string = x2; // should error here | ||
|
||
|
||
//// [commonTypeIntersection.js] | ||
var y1 = x1; // should error here | ||
var y2 = x2; // should error here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
=== tests/cases/conformance/types/intersection/commonTypeIntersection.ts === | ||
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean }; | ||
>x1 : Symbol(x1, Decl(commonTypeIntersection.ts, 0, 11)) | ||
>__typename : Symbol(__typename, Decl(commonTypeIntersection.ts, 0, 17)) | ||
>a : Symbol(a, Decl(commonTypeIntersection.ts, 0, 46)) | ||
|
||
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here | ||
>y1 : Symbol(y1, Decl(commonTypeIntersection.ts, 1, 3)) | ||
>__typename : Symbol(__typename, Decl(commonTypeIntersection.ts, 1, 9)) | ||
>a : Symbol(a, Decl(commonTypeIntersection.ts, 1, 38)) | ||
>x1 : Symbol(x1, Decl(commonTypeIntersection.ts, 0, 11)) | ||
|
||
declare let x2: { __typename?: 'TypeTwo' } & string; | ||
>x2 : Symbol(x2, Decl(commonTypeIntersection.ts, 2, 11)) | ||
>__typename : Symbol(__typename, Decl(commonTypeIntersection.ts, 2, 17)) | ||
|
||
let y2: { __typename?: 'TypeOne' } & string = x2; // should error here | ||
>y2 : Symbol(y2, Decl(commonTypeIntersection.ts, 3, 3)) | ||
>__typename : Symbol(__typename, Decl(commonTypeIntersection.ts, 3, 9)) | ||
>x2 : Symbol(x2, Decl(commonTypeIntersection.ts, 2, 11)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
=== tests/cases/conformance/types/intersection/commonTypeIntersection.ts === | ||
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean }; | ||
>x1 : { __typename?: "TypeTwo"; } & { a: boolean; } | ||
>__typename : "TypeTwo" | ||
>a : boolean | ||
|
||
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // should error here | ||
>y1 : { __typename?: "TypeOne"; } & { a: boolean; } | ||
>__typename : "TypeOne" | ||
>a : boolean | ||
>x1 : { __typename?: "TypeTwo"; } & { a: boolean; } | ||
|
||
declare let x2: { __typename?: 'TypeTwo' } & string; | ||
>x2 : { __typename?: "TypeTwo"; } & string | ||
>__typename : "TypeTwo" | ||
|
||
let y2: { __typename?: 'TypeOne' } & string = x2; // should error here | ||
>y2 : { __typename?: "TypeOne"; } & string | ||
>__typename : "TypeOne" | ||
>x2 : { __typename?: "TypeTwo"; } & string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.