Last updated: Feb 29, 2024
Reading time·4 min
The tsconfig.json error "Flag 'importsNotUsedAsValues' is deprecated and will
stop functioning in TypeScript 5.5." occurs because the importsNotUsedAsValues
key is deprecated and will be removed in TypeScript 5.5.
To resolve the issue, use the verbatimModuleSyntax
property instead or set
the ignoreDeprecations
key to 5.0
.
The article addresses the following errors:
ignoreDeprecations
key to 5.0
If you simply want to ignore the deprecations warning:
package.json
).ignoreDeprecations
key to 5.0
in your compilerOptions
object.{ "compilerOptions": { "ignoreDeprecations": "5.0", // your other properties below } }
The following configuration flags have been marked as deprecated in TypeScript version 5.0:
noImplicitUseStrict
keyofStringsOnly
suppressExcessPropertyErrors
suppressImplicitAnyIndexErrors
noStrictGenericChecks
charset
target: ES3
out
prepend
in project referencesnewLine
If you need to check your TypeScript version, follow the instructions in this article.
Even if you haven't set the deprecated importsNotUsedAsValues
property in your
tsconfig.json
file, your config file might be extending from another file that
has set the property.
Once the ignoreDeprecations
key is set to 5.0
, the deprecation warnings are
not shown.
verbatimModuleSyntax
flag insteadThe importsNotUsedAsValues
flag is used to make you specify the type
modifier in import statements that import a type.
// correct (uses type modifier) import type {User} from './user' // incorrect (does not use type modifier) import {User} from './user'
The preserveValueImports
and isolatedModules
flags are related.
Understanding the 3 flags is kind of confusing, so TypeScript v5.0 introduces a
new option called verbatimModuleSyntax
to simplify this.
When the verbatimModuleSyntax
is set to true
:
type
modifier are left around.type
modifier is dropped entirely.You can remove the importsNotUsedAsValues
flag from your tsconfig.json
file
and set the verbatimModuleSyntax
flag instead.
{ "compilerOptions": { "verbatimModuleSyntax": true, // 👇️ remove this // "importsNotUsedAsValues": "error", // ... your other properties below } }
You can read more about the verbatimModuleSyntax
flag in
this section of
the TypeScript docs.
If you get the error "Option 'target=ES6' is deprecated and will stop
functioning in TypeScript 5.5. Specify compilerOptions: 5.0 to silence the
error", set the target
property in your tsconfig.json
file to ES5
.
{ "compilerOptions": { "target": "ES5", } }
Support for the ES3 runtimes has been removed.
Instead, you should use the ES5 runtime because all modern browsers support ES5 features.
The suppressImplicitAnyIndexErrors
flag has been deprecated.
The flag disables errors that are caused when indexing an object that doesn't support indexing.
You should remove the flag from your tsconfig.json
file as it was always meant
to be temporary.
Instead, you can use an index signature to the relevant type.
Alternatively, you can disable the deprecation warning by setting the
ignoreDeprecations
property in your tsconfig.json
file.
{ "compilerOptions": { "ignoreDeprecations": "5.0", // your other properties below } }
The error "Option 'noStrictGenericChecks' is deprecated and will stop
functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations":
"5.0"' to silence this error" is shown because the noStrictGenericChecks
flag has been deprecated.
The flag was previously used to disable checks related to constraints of generic types but often causes issues.
To resolve the issue, remove the noStrictGenericChecks
flag from your
tsconfig.json
file and correct your typings or use a
type assertion.
If you get the error "Option 'out' is deprecated and will stop functioning in
TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence
this error.", use the outFile
flag instead.
Open your tsconfig.json
file and replace the out
flag with the outFile
flag.
When the outFile
flag is specified, all global (non-module) files are
concatenated into the single output file that is specified.
You can read more about the outFile
flag in
this section of the
TypeScript docs.