forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mixin logic to preserve at least one constructor type even when the
intersection also contains non-constructor types. Fixes microsoft#17388.
- Loading branch information
1 parent
b2bae85
commit a8b6164
Showing
5 changed files
with
56 additions
and
8 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
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/intersectionOfMixinConstructorTypeAndNonConstructorType.js
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 @@ | ||
//// [intersectionOfMixinConstructorTypeAndNonConstructorType.ts] | ||
// Repro for #17388 | ||
|
||
declare let x: {foo: undefined} & {new(...args: any[]): any}; | ||
new x(); | ||
|
||
|
||
//// [intersectionOfMixinConstructorTypeAndNonConstructorType.js] | ||
// Repro for #17388 | ||
new x(); |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/intersectionOfMixinConstructorTypeAndNonConstructorType.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,11 @@ | ||
=== tests/cases/compiler/intersectionOfMixinConstructorTypeAndNonConstructorType.ts === | ||
// Repro for #17388 | ||
|
||
declare let x: {foo: undefined} & {new(...args: any[]): any}; | ||
>x : Symbol(x, Decl(intersectionOfMixinConstructorTypeAndNonConstructorType.ts, 2, 11)) | ||
>foo : Symbol(foo, Decl(intersectionOfMixinConstructorTypeAndNonConstructorType.ts, 2, 16)) | ||
>args : Symbol(args, Decl(intersectionOfMixinConstructorTypeAndNonConstructorType.ts, 2, 39)) | ||
|
||
new x(); | ||
>x : Symbol(x, Decl(intersectionOfMixinConstructorTypeAndNonConstructorType.ts, 2, 11)) | ||
|
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/intersectionOfMixinConstructorTypeAndNonConstructorType.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,12 @@ | ||
=== tests/cases/compiler/intersectionOfMixinConstructorTypeAndNonConstructorType.ts === | ||
// Repro for #17388 | ||
|
||
declare let x: {foo: undefined} & {new(...args: any[]): any}; | ||
>x : { foo: undefined; } & (new (...args: any[]) => any) | ||
>foo : undefined | ||
>args : any[] | ||
|
||
new x(); | ||
>new x() : any | ||
>x : { foo: undefined; } & (new (...args: any[]) => any) | ||
|
4 changes: 4 additions & 0 deletions
4
tests/cases/compiler/intersectionOfMixinConstructorTypeAndNonConstructorType.ts
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,4 @@ | ||
// Repro for #17388 | ||
|
||
declare let x: {foo: undefined} & {new(...args: any[]): any}; | ||
new x(); |