22 lines
547 B
Plaintext
22 lines
547 B
Plaintext
tests/cases/compiler/bar.ts(2,1): error TS2322: Type '"string"' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/compiler/foo.js (0 errors) ====
|
|
|
|
class C {
|
|
constructor() {
|
|
if (cond) {
|
|
this.p = null;
|
|
}
|
|
else {
|
|
this.p = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
==== tests/cases/compiler/bar.ts (1 errors) ====
|
|
|
|
(new C()).p = "string"; // Error
|
|
~~~~~~~~~~~
|
|
!!! error TS2322: Type '"string"' is not assignable to type 'number'.
|
|
|