mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
32 lines
1.5 KiB
Plaintext
32 lines
1.5 KiB
Plaintext
2.ts(3,23): error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./0" | undefined'.
|
|
2.ts(4,24): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'undefined'.
|
|
2.ts(5,24): error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./1" | null'.
|
|
2.ts(6,24): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
|
|
|
|
|
==== 0.ts (0 errors) ====
|
|
export class B {
|
|
print() { return "I am B"}
|
|
}
|
|
|
|
export function foo() { return "foo" }
|
|
|
|
==== 1.ts (0 errors) ====
|
|
export function backup() { return "backup"; }
|
|
|
|
==== 2.ts (4 errors) ====
|
|
declare function bar(): boolean;
|
|
const specify = bar() ? "./0" : undefined;
|
|
let myModule = import(specify);
|
|
~~~~~~~
|
|
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./0" | undefined'.
|
|
let myModule1 = import(undefined);
|
|
~~~~~~~~~
|
|
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'undefined'.
|
|
let myModule2 = import(bar() ? "./1" : null);
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./1" | null'.
|
|
let myModule3 = import(null);
|
|
~~~~
|
|
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
|
|