-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add --preserveValueImports
#44619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
andrewbranch
merged 21 commits into
microsoft:main
from
andrewbranch:feature/noErasingImportedNames
Sep 8, 2021
Merged
Add --preserveValueImports
#44619
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
162ad55
Add compiler option
andrewbranch da43639
Require es2015+
andrewbranch a755070
Do not elide any imports or exports in preserve-exact
andrewbranch 8dd2455
Add errors for writing imports/exports that reference elided names
andrewbranch e6df1e5
Improve diagnostics wording
andrewbranch 126069d
Update API baselines
andrewbranch 3063638
Redo as noEraslingImportedNames
andrewbranch fccdf1f
Merge branch 'main' into feature/noErasingImportedNames
andrewbranch 30ffc15
Update option category
andrewbranch 0b02873
Update baselines
andrewbranch bc850fa
Lint
andrewbranch 71f4e71
Fix up transformer comments
andrewbranch 961a014
Merge branch 'main' into feature/noErasingImportedNames
andrewbranch b5ed171
Fix errors from merge
andrewbranch bc91a25
Update other error code baseline
andrewbranch f8c6869
Rename to "preserveValueImports"
andrewbranch 9e2e4dc
Clean up, reword diagnostics
andrewbranch bff0093
Update API baselines
andrewbranch dd5ab20
Update other baseline affected by error message reword
andrewbranch dc9e02d
Update tsconfig baselines
andrewbranch c27d59a
Add debug assertion instead of !
andrewbranch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Redo as noEraslingImportedNames
- Loading branch information
commit 30636381e2259f1213e021ee75ec5f166ccecdc8
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
7 changes: 0 additions & 7 deletions
7
...s/baselines/reference/importsNotUsedAsValues_preserve-exact_module(module=amd).errors.txt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...elines/reference/importsNotUsedAsValues_preserve-exact_module(module=commonjs).errors.txt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tests/baselines/reference/importsNotUsedAsValues_preserve-exact_module(module=commonjs).js
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
tests/baselines/reference/importsNotUsedAsValues_preserve-exact_module(module=es2015).js
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
...aselines/reference/importsNotUsedAsValues_preserve-exact_module(module=system).errors.txt
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../importsNotUsedAsValues_preserve-exact.js → ...ngImportedNames(isolatedmodules=false).js
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
tests/baselines/reference/noErasingImportedNames(isolatedmodules=true).errors.txt
This file contains hidden or 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,35 @@ | ||
| tests/cases/conformance/externalModules/typeOnly/d.ts(1,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. | ||
| tests/cases/conformance/externalModules/typeOnly/e.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. | ||
| tests/cases/conformance/externalModules/typeOnly/e.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. | ||
|
|
||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/a.ts (0 errors) ==== | ||
| export default {}; | ||
| export const b = 0; | ||
| export const c = 1; | ||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/b.ts (0 errors) ==== | ||
| import a, { b, c } from "./a"; | ||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/c.ts (0 errors) ==== | ||
| import * as a from "./a"; | ||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/d.ts (1 errors) ==== | ||
| export = {}; | ||
| ~~~~~~~~~~~~ | ||
| !!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. | ||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/e.ts (2 errors) ==== | ||
| import D = require("./d"); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| !!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. | ||
| import DD = require("./d"); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| !!! error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. | ||
| DD; | ||
|
|
||
| ==== tests/cases/conformance/externalModules/typeOnly/f.ts (0 errors) ==== | ||
| import type a from "./a"; | ||
| import { b, c } from "./a"; | ||
| b; | ||
|
|
43 changes: 43 additions & 0 deletions
43
tests/baselines/reference/noErasingImportedNames(isolatedmodules=true).js
This file contains hidden or 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,43 @@ | ||
| //// [tests/cases/conformance/externalModules/typeOnly/noErasingImportedNames.ts] //// | ||
|
|
||
| //// [a.ts] | ||
| export default {}; | ||
| export const b = 0; | ||
| export const c = 1; | ||
|
|
||
| //// [b.ts] | ||
| import a, { b, c } from "./a"; | ||
|
|
||
| //// [c.ts] | ||
| import * as a from "./a"; | ||
|
|
||
| //// [d.ts] | ||
| export = {}; | ||
|
|
||
| //// [e.ts] | ||
| import D = require("./d"); | ||
| import DD = require("./d"); | ||
| DD; | ||
|
|
||
| //// [f.ts] | ||
| import type a from "./a"; | ||
| import { b, c } from "./a"; | ||
| b; | ||
|
|
||
|
|
||
| //// [a.js] | ||
| export default {}; | ||
| export var b = 0; | ||
| export var c = 1; | ||
| //// [b.js] | ||
| import a, { b, c } from "./a"; | ||
| //// [c.js] | ||
| import * as a from "./a"; | ||
| //// [d.js] | ||
| export {}; | ||
| //// [e.js] | ||
| DD; | ||
| export {}; | ||
| //// [f.js] | ||
| import { b, c } from "./a"; | ||
| b; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.