-
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.
Allow cross-project references to const enums in isolatedModules when…
… referenced project has preserveConstEnums (#57914)
- Loading branch information
1 parent
fd388f7
commit b24b5c4
Showing
7 changed files
with
464 additions
and
2 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
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
61 changes: 61 additions & 0 deletions
61
...erences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js
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,61 @@ | ||
currentDirectory:: / useCaseSensitiveFileNames: false | ||
Input:: | ||
//// [/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/src/project/index.ts] | ||
import { E } from "../utils"; E.A; | ||
|
||
//// [/src/project/tsconfig.json] | ||
{ | ||
"compilerOptions": { | ||
"isolatedModules": true | ||
}, | ||
"references": [ | ||
{ | ||
"path": "../utils" | ||
} | ||
] | ||
} | ||
|
||
//// [/src/utils/index.d.ts] | ||
export declare const enum E { A = 1 } | ||
|
||
//// [/src/utils/index.ts] | ||
export const enum E { A = 1 } | ||
|
||
//// [/src/utils/tsconfig.json] | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"declaration": true, | ||
"preserveConstEnums": true | ||
} | ||
} | ||
|
||
|
||
|
||
Output:: | ||
/lib/tsc --p src/project | ||
exitCode:: ExitStatus.Success | ||
|
||
|
||
//// [/src/project/index.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
utils_1.E.A; | ||
|
||
|
Oops, something went wrong.