ngx-grpc icon indicating copy to clipboard operation
ngx-grpc copied to clipboard

Incompatability with verbatimModuleSyntax

Open LoaderB0T opened this issue 6 months ago • 0 comments

Hi there,

we just discovered that the protoc-gen-ng package is incompatible with the verbatimModuleSyntax flag in the tsconfig.

An example of what gets generated:

import {
  GrpcCallType,
  GrpcClient,
  GrpcClientFactory,
  GrpcEvent,
  GrpcMetadata,
} from '@ngx-grpc/common';

However, some of these imports have to be imported with the type keyword when using verbatimModuleSyntax So for this example, the correct import statement would be:

import {
  GrpcCallType,
  type GrpcClient,
  type GrpcClientFactory,
  type GrpcEvent,
  GrpcMetadata,
} from '@ngx-grpc/common';

Since Angular 18.2 using isolatedModules in the tsconfig provides a performance boost and the developer experience is better when using verbatimModuleSyntax as the auto imports eg. in vscode are more usable that way.

I will create a PR with a proposal for a fix shortly. Note: changing this does NOT create a breaking change

LoaderB0T avatar Aug 21 '24 08:08 LoaderB0T