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 59 60
|
tests/cases/conformance/externalModules/typeOnly/component.ts(12,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(16,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(20,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(24,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
==== tests/cases/conformance/externalModules/typeOnly/framework-hooks.ts (0 errors) ====
export const onInit = Symbol("onInit");
==== tests/cases/conformance/externalModules/typeOnly/component.ts (4 errors) ====
import type { onInit } from "./framework-hooks";
interface Component {
[onInit]?(): void;
}
type T = {
[onInit]: any;
}
const o = {
[onInit]: 0 // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
};
class C {
[onInit]: any; // Error (because class fields)
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}
class D {
[onInit] = 0; // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}
class E {
[onInit]() {} // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}
abstract class F {
abstract [onInit](): void;
}
class G {
declare [onInit]: any;
}
declare class H {
[onInit]: any;
}
|