-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
cliCLI related issueCLI related issue
Description
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:
import type { LangiumGeneratedServices, LangiumGeneratedSharedServices, LangiumSharedServices, LangiumServices, LanguageMetaData, Module } from 'langium';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:
import type {SomeType} from 'something-that-has-side-effects'
import 'something-that-has-side-effects' // This will be keptspoenemann
Metadata
Metadata
Assignees
Labels
cliCLI related issueCLI related issue
