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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/a.js(3,10): error TS2339: Property 'test' does not exist on type 'Foo'.
/a.js(8,10): error TS2339: Property 'test' does not exist on type 'Foo'.
/a.js(13,10): error TS2339: Property 'test' does not exist on type 'Foo'.
/a.js(18,10): error TS2339: Property 'test' does not exist on type 'Foo'.
/a.js(23,10): error TS2339: Property 'test' does not exist on type 'Foo'.
/a.js(28,10): error TS2339: Property 'test' does not exist on type 'Foo'.
==== /types.d.ts (0 errors) ====
export interface Foo {
foo: () => void;
}
export type M = (this: Foo) => void;
==== /a.js (6 errors) ====
/** @type {import('./types').M} */
export const f1 = function() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
/** @type {import('./types').M} */
export function f2() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
/** @type {(this: import('./types').Foo) => void} */
export const f3 = function() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
/** @type {(this: import('./types').Foo) => void} */
export function f4() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
/** @type {function(this: import('./types').Foo): void} */
export const f5 = function() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
/** @type {function(this: import('./types').Foo): void} */
export function f6() {
this.test();
~~~~
!!! error TS2339: Property 'test' does not exist on type 'Foo'.
}
|