Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toObject() inferred type too long when compiled with declaration: true #231

Open
Hilzu opened this issue Sep 30, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Hilzu
Copy link

Hilzu commented Sep 30, 2023

I'm working with pg_query.proto from libpg_query and encountered this issue generating code with protoc-gen-ts.

When compiling the generated module with "declaration": true set in tsconfig.json the tsc build fails with the following error:

src/protoc-gen-ts/pg_query.ts:76418:9 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

76418         toObject() {
              ~~~~~~~~


Found 1 error in src/protoc-gen-ts/pg_query.ts:76418

Something about enabling generating declaration files seems to cause the toObject inferred type to become too long for tsc. There might be other option that cause this but I could reliably reproduce the issue with the declaration option.

Issue is reproduced here: https://github.com/Hilzu/ts-proto-with-pg-query/tree/protoc-gen-ts

@Yo-mah-Ya
Copy link

Yo-mah-Ya commented Oct 7, 2023

Same here!
I just fixed this problem to add return type explicitly using type aliases to prevent from making file size bigger.

#232

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants