Typescript tsconfig.json verbatimModuleSyntax

Typescript contains following properties

  • isolatedModules,
  • preserveValueImports
  • importsNotUsedAsValues

verbatimModuleSyntax is a new configuration option introduced in typescript 5.0 to solve Import Eplison

This can be configured

  • command line —verbatimModuleSyntax o
  • Configure compilerOptions with verbatimModuleSyntax property tsconfig.json
{
  "compilerOptions": {
    "verbatimModuleSyntax": "true"
  }
}

If your application or the dependencies modules throws an error for below usecases.

  • Typescript version is latest or 5.5 version
  • Typescript tsconfig.json contains following property
"importsNotUsedAsValues": "error"

For example, Consider, you are working on VueJS application with typescript . If you got this error,

First, You do search in entire application for property importsNotUsedAsValues, did not found. Then, Make sure that vuejs packages update to the latest version.

If you got the same error again after updating all vuejs libraries to latest version, Then, Let’s see how to fix this error

Fix for “Flag ‘importsNotUsedAsValues’ is deprecated and will stop functioning in TypeScript 5.5.”?

Multiple ways to fix importsNotUsedAsValues is deprecated error

  • ignoreDeprecations property in tsconfig.json of your property

add ignoreDeprecations property with 5.0 in tsconfig.json.

{
  "compilerOptions": {
    "ignoreDeprecations": "5.0"
  }
}
  • Another way, Use verbatimModuleSyntax syntax instead

Update verbatimModuleSyntax to true in tsconfig.json

{
  "compilerOptions": {
    "verbatimModuleSyntax": true
  }
}