-
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.
Merge branch 'master' into noConstraint-is-unknown
- Loading branch information
Showing
23 changed files
with
1,457 additions
and
103 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/errorMessageOnIntersectionsWithDiscriminants01.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,22 @@ | ||
tests/cases/compiler/errorMessageOnIntersectionsWithDiscriminants01.ts(8,1): error TS2322: Type 'A' is not assignable to type 'B'. | ||
Type '{ test: true; } & { foo: 1; }' is not assignable to type 'B'. | ||
Type '{ test: true; } & { foo: 1; }' is not assignable to type '{ test: true; } & { bar: 1; }'. | ||
Property 'bar' is missing in type '{ test: true; } & { foo: 1; }' but required in type '{ bar: 1; }'. | ||
|
||
|
||
==== tests/cases/compiler/errorMessageOnIntersectionsWithDiscriminants01.ts (1 errors) ==== | ||
export type Common = { test: true } | { test: false }; | ||
export type A = Common & { foo: 1 }; | ||
export type B = Common & { bar: 1 }; | ||
|
||
declare const a: A; | ||
declare let b: B; | ||
|
||
b = a; | ||
~ | ||
!!! error TS2322: Type 'A' is not assignable to type 'B'. | ||
!!! error TS2322: Type '{ test: true; } & { foo: 1; }' is not assignable to type 'B'. | ||
!!! error TS2322: Type '{ test: true; } & { foo: 1; }' is not assignable to type '{ test: true; } & { bar: 1; }'. | ||
!!! error TS2322: Property 'bar' is missing in type '{ test: true; } & { foo: 1; }' but required in type '{ bar: 1; }'. | ||
!!! related TS2728 tests/cases/compiler/errorMessageOnIntersectionsWithDiscriminants01.ts:3:28: 'bar' is declared here. | ||
|
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/errorMessageOnIntersectionsWithDiscriminants01.symbols
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,28 @@ | ||
=== tests/cases/compiler/errorMessageOnIntersectionsWithDiscriminants01.ts === | ||
export type Common = { test: true } | { test: false }; | ||
>Common : Symbol(Common, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 0)) | ||
>test : Symbol(test, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 22)) | ||
>test : Symbol(test, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 39)) | ||
|
||
export type A = Common & { foo: 1 }; | ||
>A : Symbol(A, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 54)) | ||
>Common : Symbol(Common, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 0)) | ||
>foo : Symbol(foo, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 1, 26)) | ||
|
||
export type B = Common & { bar: 1 }; | ||
>B : Symbol(B, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 1, 36)) | ||
>Common : Symbol(Common, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 0)) | ||
>bar : Symbol(bar, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 2, 26)) | ||
|
||
declare const a: A; | ||
>a : Symbol(a, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 4, 13)) | ||
>A : Symbol(A, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 0, 54)) | ||
|
||
declare let b: B; | ||
>b : Symbol(b, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 5, 11)) | ||
>B : Symbol(B, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 1, 36)) | ||
|
||
b = a; | ||
>b : Symbol(b, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 5, 11)) | ||
>a : Symbol(a, Decl(errorMessageOnIntersectionsWithDiscriminants01.ts, 4, 13)) | ||
|
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/errorMessageOnIntersectionsWithDiscriminants01.types
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,27 @@ | ||
=== tests/cases/compiler/errorMessageOnIntersectionsWithDiscriminants01.ts === | ||
export type Common = { test: true } | { test: false }; | ||
>Common : Common | ||
>test : true | ||
>true : true | ||
>test : false | ||
>false : false | ||
|
||
export type A = Common & { foo: 1 }; | ||
>A : A | ||
>foo : 1 | ||
|
||
export type B = Common & { bar: 1 }; | ||
>B : B | ||
>bar : 1 | ||
|
||
declare const a: A; | ||
>a : A | ||
|
||
declare let b: B; | ||
>b : B | ||
|
||
b = a; | ||
>b = a : A | ||
>b : B | ||
>a : A | ||
|
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
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.