Autogenerated code erro: Cannot use namespace 'Long' as a type
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Problem description
The autogenerated type code from `@grpc/grpc-js` is generating code that is not valid typescript.
## Example Error
For example, the `Long` that is imported causes an error:

I edited the autogenerated file by using `typeof Long` further below in the code & that made the typescript error go away.
This works because [Namespaces can be converted to types using the `typeof` keyword](https://stackoverflow.com/a/70779907).

### Reproduction steps
Work in progress
This is what my settings for generating types looks like using @grpc/proto-loader
https://www.npmjs.com/package/@grpc/proto-loader#generating-typescript-types
```sh
yarn run proto-loader-gen-types \
-I $PROTOS_DESTINATION_DIR/serviceProto \
-I $PROTOS_DESTINATION_DIR \
--keepCase \
--longs=String \
--enums=String \
--defaults \
--oneofs \
--grpcLib=@grpc/grpc-js \
--outDir=$PROTOS_DESTINATION_DIR \
$PROTOS_DESTINATION_DIR/serviceProto/proto/com/linkedin/euler/controlplane/*.proto
```
### Environment
OS Name: Sonomo 14.1.1
Node version 20.5.0
Typrscript: 5.0.4
@grpc/grpc-js": "1.9.9",
@grpc/proto-loader": "0.7.10",
Contributor guide
Assessment
This issue has not been assessed yet.