Add --preserveValueImports (#44619)

* Add compiler option

* Require es2015+

* Do not elide any imports or exports in preserve-exact

* Add errors for writing imports/exports that reference elided names

* Improve diagnostics wording

* Update API baselines

* Redo as noEraslingImportedNames

* Update option category

* Update baselines

* Lint

* Fix up transformer comments

* Fix errors from merge

* Update other error code baseline

* Rename to "preserveValueImports"

* Clean up, reword diagnostics

* Update API baselines

* Update other baseline affected by error message reword

* Update tsconfig baselines

* Add debug assertion instead of !
This commit is contained in:
Andrew Branch
2021-09-08 16:30:22 -07:00
committed by GitHub
parent b9eeb74f37
commit 8610ff5ebe
55 changed files with 1367 additions and 40 deletions
+9 -1
View File
@@ -571,7 +571,7 @@ namespace ts {
type: new Map(getEntries({
remove: ImportsNotUsedAsValues.Remove,
preserve: ImportsNotUsedAsValues.Preserve,
error: ImportsNotUsedAsValues.Error
error: ImportsNotUsedAsValues.Error,
})),
affectsEmit: true,
affectsSemanticDiagnostics: true,
@@ -1169,6 +1169,14 @@ namespace ts {
description: Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
defaultValueDescription: Diagnostics.true_for_ES2022_and_above_including_ESNext
},
{
name: "preserveValueImports",
type: "boolean",
affectsEmit: true,
category: Diagnostics.Emit,
description: Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
},
{
name: "keyofStringsOnly",
type: "boolean",