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.
Add more information in case of incompatible constructor signature mi…
- Loading branch information
amaksimovich
committed
Mar 13, 2019
1 parent
1463b32
commit c3e0413
Showing
7 changed files
with
58 additions
and
0 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
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
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/assigningIncompatibleConstructor.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,13 @@ | ||
tests/cases/compiler/assigningIncompatibleConstructor.ts(2,5): error TS2322: Type 'typeof Foo' is not assignable to type 'new () => Foo'. | ||
Types of constructor signature are incompatible. | ||
Type 'new (a: string) => Foo' is not assignable to type 'new () => Foo'. | ||
|
||
|
||
==== tests/cases/compiler/assigningIncompatibleConstructor.ts (1 errors) ==== | ||
class Foo { constructor(a: string) { } } | ||
let FooConstructor: { new(): Foo } = Foo; | ||
~~~~~~~~~~~~~~ | ||
!!! error TS2322: Type 'typeof Foo' is not assignable to type 'new () => Foo'. | ||
!!! error TS2322: Types of constructor signature are incompatible. | ||
!!! error TS2322: Type 'new (a: string) => Foo' is not assignable to type 'new () => Foo'. | ||
|
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/assigningIncompatibleConstructor.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,12 @@ | ||
//// [assigningIncompatibleConstructor.ts] | ||
class Foo { constructor(a: string) { } } | ||
let FooConstructor: { new(): Foo } = Foo; | ||
|
||
|
||
//// [assigningIncompatibleConstructor.js] | ||
var Foo = /** @class */ (function () { | ||
function Foo(a) { | ||
} | ||
return Foo; | ||
}()); | ||
var FooConstructor = Foo; |
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/assigningIncompatibleConstructor.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,10 @@ | ||
=== tests/cases/compiler/assigningIncompatibleConstructor.ts === | ||
class Foo { constructor(a: string) { } } | ||
>Foo : Symbol(Foo, Decl(assigningIncompatibleConstructor.ts, 0, 0)) | ||
>a : Symbol(a, Decl(assigningIncompatibleConstructor.ts, 0, 24)) | ||
|
||
let FooConstructor: { new(): Foo } = Foo; | ||
>FooConstructor : Symbol(FooConstructor, Decl(assigningIncompatibleConstructor.ts, 1, 3)) | ||
>Foo : Symbol(Foo, Decl(assigningIncompatibleConstructor.ts, 0, 0)) | ||
>Foo : Symbol(Foo, Decl(assigningIncompatibleConstructor.ts, 0, 0)) | ||
|
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/assigningIncompatibleConstructor.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,9 @@ | ||
=== tests/cases/compiler/assigningIncompatibleConstructor.ts === | ||
class Foo { constructor(a: string) { } } | ||
>Foo : Foo | ||
>a : string | ||
|
||
let FooConstructor: { new(): Foo } = Foo; | ||
>FooConstructor : new () => Foo | ||
>Foo : typeof Foo | ||
|
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,2 @@ | ||
class Foo { constructor(a: string) { } } | ||
let FooConstructor: { new(): Foo } = Foo; |