In version 3.8, Typescript enabled a new syntax for type-only import.
This enables to erase of the import at runtime.
For example:
import type { SQSEvent, SQSHandler } from 'aws-lambda';
By default, Visual Studio Code import
without type
To enable import
with type
, you need to add the following to your tsconfig.json
{
"compilerOptions": {
"importsNotUsedAsValues": "error",
},
}
Now, Visual Studio Code import
with type
Top comments (0)