grpc / grpc/grpc-node

Typescript Type generation not working using proto-loader-gen-types

Open
#3,077 1 comment 0 reactions 0 assignees View on GitHub
feature request
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

**Problem description**

I can not generate typescript types.

**Dependencies**

"@grpc/grpc-js": "^1.14.4",
"@grpc/proto-loader": "^0.8.1",

Proto files are located in the project root directory inside `proto` in the following structure:

```
proto/common/v1/common.proto
proto/user/v1/user.proto
proto/tag/v1/tag.proto
```

When I run the command by providing individual proto file through make command:

❯ \@npx proto-loader-gen-types --longs=String --enums=String--defaults --oneofs --grpcLib=@grpc/grpc-js -I=./proto/ -O=src/lib/server/grpc/types/ user/v1/user.proto

It works and generates the necessary types in the desired directory.

However when I run this:

❯ \@npx proto-loader-gen-types --longs=String --enums=String--defaults --oneofs --grpcLib=@grpc/grpc-js -I=./proto/ -O=src/lib/server/grpc/types/ \*\*/\*\*/*.proto

It does not work.

It does not work with `*/*/*.proto` , `*.proto` , `*/*.proto` .

I get the error when I try with various approaches of using \*:

```
(node:9591) Warning: */*.proto not found in any of the include paths proto/
(Use `node --trace-warnings ...` to show where the warning was created)
[Error: ENOENT: no such file or directory, open '*/*.proto'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '*/*.proto'
}
make: *** [testss] Error 1
```

I also ran :
```testss:
@npx proto-loader-gen-types --longs=String --enums=String--defaults --oneofs --grpcLib=@grpc/grpc-js -I=./proto/ -O=src/lib/server/grpc/types/ user/v1/*.proto
```
It doesn't work either. When I remove \* and give the actual filename, it works however.

My assumption is that * is not being expanded at all.

**Environment**

OS name, version and architecture: MacOS Tahoe 26.6.2
Node version: v24.12.0
Npx Version: v11.6.2

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported commands from the Make target using the proto directory layout and the listed Node and package versions. Inspect how wildcard arguments are passed to proto-loader-gen-types and confirm that supported patterns generate the same types as an individual user/v1/user.proto input without the ENOENT error.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.