Langium TypeScript output should use type
imports for non-value imports
#960
Labels
cli
CLI related issue
type
imports for non-value imports
#960
Currently if a user updates their tsconfig to have the option
"importsNotUsedAsValues": "error"
, they will get a type error in generated code:So what Langium can do is output type-only imports like the following, for anything that is type-only:
This is nice because, when bundling a lib for release, we want to import only files that are actually used. This setting tells TypeScript that it can safely remove the import statement from the output because no values are actually used, it is only for type checking.
If someone does need a side-effect import (or the generated code does), while they have this option enabled, the way to do that would be like so:
The text was updated successfully, but these errors were encountered: