Skip to content

Commit f807b57

Browse files
Add s to importsNotUsedAsValue (#36037)
* Pluralize end of 'importsNotUsedAsValue'. * Updated baselines.
1 parent f8bfc6f commit f807b57

File tree

15 files changed

+29
-29
lines changed

15 files changed

+29
-29
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33134,12 +33134,12 @@ namespace ts {
3313433134
importClauseContainsReferencedImport(statement.importClause) &&
3313533135
!isReferencedAliasDeclaration(statement.importClause, /*checkChildren*/ true)
3313633136
) {
33137-
const isError = compilerOptions.importsNotUsedAsValue === ImportsNotUsedAsValue.Error;
33137+
const isError = compilerOptions.importsNotUsedAsValues === importsNotUsedAsValues.Error;
3313833138
errorOrSuggestion(
3313933139
isError,
3314033140
statement,
3314133141
isError
33142-
? Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_the_importsNotUsedAsValue_is_set_to_error
33142+
? Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_the_importsNotUsedAsValues_is_set_to_error
3314333143
: Diagnostics.This_import_may_be_converted_to_a_type_only_import);
3314433144
}
3314533145
}

src/compiler/commandLineParser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ namespace ts {
473473
description: Diagnostics.Import_emit_helpers_from_tslib
474474
},
475475
{
476-
name: "importsNotUsedAsValue",
476+
name: "importsNotUsedAsValues",
477477
type: createMapFromTemplate({
478-
remove: ImportsNotUsedAsValue.Remove,
479-
preserve: ImportsNotUsedAsValue.Preserve,
480-
error: ImportsNotUsedAsValue.Error
478+
remove: importsNotUsedAsValues.Remove,
479+
preserve: importsNotUsedAsValues.Preserve,
480+
error: importsNotUsedAsValues.Error
481481
}),
482482
affectsEmit: true,
483483
category: Diagnostics.Advanced_Options,

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@
10991099
"category": "Error",
11001100
"code": 1370
11011101
},
1102-
"This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.": {
1102+
"This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.": {
11031103
"category": "Error",
11041104
"code": 1371
11051105
},

src/compiler/transformers/ts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,7 +2760,7 @@ namespace ts {
27602760
}
27612761

27622762
/**
2763-
* Visits an import declaration, eliding it if it is not referenced and `importsNotUsedAsValue` is not 'preserve'.
2763+
* Visits an import declaration, eliding it if it is not referenced and `importsNotUsedAsValues` is not 'preserve'.
27642764
*
27652765
* @param node The import declaration node.
27662766
*/
@@ -2778,8 +2778,8 @@ namespace ts {
27782778
// Elide the declaration if the import clause was elided.
27792779
const importClause = visitNode(node.importClause, visitImportClause, isImportClause);
27802780
return importClause ||
2781-
compilerOptions.importsNotUsedAsValue === ImportsNotUsedAsValue.Preserve ||
2782-
compilerOptions.importsNotUsedAsValue === ImportsNotUsedAsValue.Error
2781+
compilerOptions.importsNotUsedAsValues === importsNotUsedAsValues.Preserve ||
2782+
compilerOptions.importsNotUsedAsValues === importsNotUsedAsValues.Error
27832783
? updateImportDeclaration(
27842784
node,
27852785
/*decorators*/ undefined,
@@ -2931,7 +2931,7 @@ namespace ts {
29312931
if (isExternalModuleImportEqualsDeclaration(node)) {
29322932
const isReferenced = resolver.isReferencedAliasDeclaration(node);
29332933
// If the alias is unreferenced but we want to keep the import, replace with 'import "mod"'.
2934-
if (!isReferenced && compilerOptions.importsNotUsedAsValue === ImportsNotUsedAsValue.Preserve) {
2934+
if (!isReferenced && compilerOptions.importsNotUsedAsValues === importsNotUsedAsValues.Preserve) {
29352935
return setOriginalNode(
29362936
setTextRange(
29372937
createImportDeclaration(

src/compiler/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5043,7 +5043,7 @@ namespace ts {
50435043
/*@internal*/generateCpuProfile?: string;
50445044
/*@internal*/help?: boolean;
50455045
importHelpers?: boolean;
5046-
importsNotUsedAsValue?: ImportsNotUsedAsValue;
5046+
importsNotUsedAsValues?: importsNotUsedAsValues;
50475047
/*@internal*/init?: boolean;
50485048
inlineSourceMap?: boolean;
50495049
inlineSources?: boolean;
@@ -5165,7 +5165,7 @@ namespace ts {
51655165
ReactNative = 3
51665166
}
51675167

5168-
export const enum ImportsNotUsedAsValue {
5168+
export const enum importsNotUsedAsValues {
51695169
Remove,
51705170
Preserve,
51715171
Error

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,7 @@ declare namespace ts {
26512651
experimentalDecorators?: boolean;
26522652
forceConsistentCasingInFileNames?: boolean;
26532653
importHelpers?: boolean;
2654-
importsNotUsedAsValue?: ImportsNotUsedAsValue;
2654+
importsNotUsedAsValues?: importsNotUsedAsValues;
26552655
inlineSourceMap?: boolean;
26562656
inlineSources?: boolean;
26572657
isolatedModules?: boolean;
@@ -2750,7 +2750,7 @@ declare namespace ts {
27502750
React = 2,
27512751
ReactNative = 3
27522752
}
2753-
export enum ImportsNotUsedAsValue {
2753+
export enum importsNotUsedAsValues {
27542754
Remove = 0,
27552755
Preserve = 1,
27562756
Error = 2

tests/baselines/reference/api/typescript.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,7 @@ declare namespace ts {
26512651
experimentalDecorators?: boolean;
26522652
forceConsistentCasingInFileNames?: boolean;
26532653
importHelpers?: boolean;
2654-
importsNotUsedAsValue?: ImportsNotUsedAsValue;
2654+
importsNotUsedAsValues?: importsNotUsedAsValues;
26552655
inlineSourceMap?: boolean;
26562656
inlineSources?: boolean;
26572657
isolatedModules?: boolean;
@@ -2750,7 +2750,7 @@ declare namespace ts {
27502750
React = 2,
27512751
ReactNative = 3
27522752
}
2753-
export enum ImportsNotUsedAsValue {
2753+
export enum importsNotUsedAsValues {
27542754
Remove = 0,
27552755
Preserve = 1,
27562756
Error = 2

tests/baselines/reference/importsNotUsedAsValue_error.errors.txt renamed to tests/baselines/reference/importsNotUsedAsValues_error.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/b.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.
2-
/c.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.
1+
/b.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
2+
/c.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
33
/e.ts(1,1): error TS6192: All imports in import declaration are unused.
44

55

@@ -11,15 +11,15 @@
1111
==== /b.ts (1 errors) ====
1212
import { A, B } from './a'; // Error
1313
~~~~~~~~~~~~~~~~~~~~~~~~~~~
14-
!!! error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.
14+
!!! error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
1515
let a: A;
1616
let b: B;
1717
console.log(a, b);
1818

1919
==== /c.ts (1 errors) ====
2020
import Default, * as named from './a'; // Error
2121
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22-
!!! error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValue' is set to 'error'.
22+
!!! error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
2323
let a: Default;
2424
let b: named.B;
2525
console.log(a, b);

tests/baselines/reference/importsNotUsedAsValue_error.js renamed to tests/baselines/reference/importsNotUsedAsValues_error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/externalModules/typeOnly/importsNotUsedAsValue_error.ts] ////
1+
//// [tests/cases/conformance/externalModules/typeOnly/importsNotUsedAsValues_error.ts] ////
22

33
//// [a.ts]
44
export default class {}

0 commit comments

Comments
 (0)