-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isolatedModules error on alias merging with local value (#56354)
- Loading branch information
1 parent
e40730f
commit a636797
Showing
7 changed files
with
90 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
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
19 changes: 19 additions & 0 deletions
19
...ModulesSketchyAliasLocalMerge(isolatedmodules=false,verbatimmodulesyntax=true).errors.txt
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,19 @@ | ||
bad.ts(1,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. | ||
bad.ts(1,10): error TS1484: 'FC' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. | ||
|
||
|
||
==== types.ts (0 errors) ==== | ||
export type FC = () => void; | ||
|
||
==== bad.ts (2 errors) ==== | ||
import { FC } from "./types"; | ||
~~ | ||
!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. | ||
~~ | ||
!!! error TS1484: 'FC' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. | ||
let FC: FC | null = null; | ||
|
||
==== good.ts (0 errors) ==== | ||
import type { FC } from "./types"; | ||
let FC: FC | null = null; | ||
|
16 changes: 16 additions & 0 deletions
16
...ModulesSketchyAliasLocalMerge(isolatedmodules=true,verbatimmodulesyntax=false).errors.txt
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,16 @@ | ||
bad.ts(1,10): error TS2865: Import 'FC' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled. | ||
|
||
|
||
==== types.ts (0 errors) ==== | ||
export type FC = () => void; | ||
|
||
==== bad.ts (1 errors) ==== | ||
import { FC } from "./types"; | ||
~~ | ||
!!! error TS2865: Import 'FC' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled. | ||
let FC: FC | null = null; | ||
|
||
==== good.ts (0 errors) ==== | ||
import type { FC } from "./types"; | ||
let FC: FC | null = null; | ||
|
22 changes: 22 additions & 0 deletions
22
...dModulesSketchyAliasLocalMerge(isolatedmodules=true,verbatimmodulesyntax=true).errors.txt
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,22 @@ | ||
bad.ts(1,10): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. | ||
bad.ts(1,10): error TS1484: 'FC' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. | ||
bad.ts(1,10): error TS2865: Import 'FC' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled. | ||
|
||
|
||
==== types.ts (0 errors) ==== | ||
export type FC = () => void; | ||
|
||
==== bad.ts (3 errors) ==== | ||
import { FC } from "./types"; | ||
~~ | ||
!!! error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled. | ||
~~ | ||
!!! error TS1484: 'FC' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. | ||
~~ | ||
!!! error TS2865: Import 'FC' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled. | ||
let FC: FC | null = null; | ||
|
||
==== good.ts (0 errors) ==== | ||
import type { FC } from "./types"; | ||
let FC: FC | null = null; | ||
|
15 changes: 15 additions & 0 deletions
15
tests/cases/compiler/isolatedModulesSketchyAliasLocalMerge.ts
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,15 @@ | ||
// @isolatedModules: false, true | ||
// @verbatimModuleSyntax: false, true | ||
// @noEmit: true | ||
// @noTypesAndSymbols: true | ||
|
||
// @Filename: types.ts | ||
export type FC = () => void; | ||
|
||
// @Filename: bad.ts | ||
import { FC } from "./types"; | ||
let FC: FC | null = null; | ||
|
||
// @Filename: good.ts | ||
import type { FC } from "./types"; | ||
let FC: FC | null = null; |