mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
--- old.constructorFunctionsStrict.errors.txt
|
|
+++ new.constructorFunctionsStrict.errors.txt
|
|
@@= skipped -0, +0 lines =@@
|
|
-a.js(9,1): error TS2322: Type 'undefined' is not assignable to type 'number'.
|
|
-
|
|
-
|
|
-==== a.js (1 errors) ====
|
|
+a.js(8,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
+a.js(15,16): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
+a.js(20,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
+
|
|
+
|
|
+==== a.js (3 errors) ====
|
|
/** @param {number} x */
|
|
function C(x) {
|
|
this.x = x
|
|
@@= skipped -9, +11 lines =@@
|
|
this.y = 12
|
|
}
|
|
var c = new C(1)
|
|
+ ~~~~~~~~
|
|
+!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
c.x = undefined // should error
|
|
- ~~~
|
|
-!!! error TS2322: Type 'undefined' is not assignable to type 'number'.
|
|
c.y = undefined // ok
|
|
|
|
/** @param {number} x */
|
|
function A(x) {
|
|
if (!(this instanceof A)) {
|
|
return new A(x)
|
|
+ ~~~~~~~~
|
|
+!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
}
|
|
this.x = x
|
|
}
|
|
var k = A(1)
|
|
var j = new A(2)
|
|
+ ~~~~~~~~
|
|
+!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type.
|
|
k.x === j.x
|
|
|