1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/test.js(3,9): error TS2322: Type '{}' is not assignable to type 'string'.
/test.js(6,5): error TS8009: The 'declare' modifier can only be used in TypeScript files.
/test.js(6,19): error TS8010: Type annotations can only be used in TypeScript files.
/test.js(9,19): error TS2339: Property 'foo' does not exist on type 'string'.
==== /test.js (4 errors) ====
class Foo {
constructor() {
this.prop = {};
~~~~~~~~~
!!! error TS2322: Type '{}' is not assignable to type 'string'.
}
declare prop: string;
~~~~~~~
!!! error TS8009: The 'declare' modifier can only be used in TypeScript files.
~~~~~~
!!! error TS8010: Type annotations can only be used in TypeScript files.
method() {
this.prop.foo
~~~
!!! error TS2339: Property 'foo' does not exist on type 'string'.
}
}
|