-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8571a8a
commit 8b4c235
Showing
4 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters