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

Compiling generated code causes a heap overflow with tsc #929

Closed
Hilzu opened this issue Sep 30, 2023 · 1 comment
Closed

Compiling generated code causes a heap overflow with tsc #929

Hilzu opened this issue Sep 30, 2023 · 1 comment

Comments

@Hilzu
Copy link
Contributor

Hilzu commented Sep 30, 2023

I'm using ts-proto to generate code from pg_query.proto from libpg_query. With default options compiling the generated code causes tsc to crash due to a heap overflow. Using the --generateTrace option and @typescript/analyze-trace tool this seems to be caused by the fromPartial function for Node message. Using --ts_proto_opt=outputPartialMethods=false fixes the heap overflow.

I have reproduced the issue here: https://github.com/Hilzu/ts-proto-with-pg-query#ts-proto-generated-code-causes-a-heap-overflow-with-tsc

@stephenh
Copy link
Owner

Hi @Hilzu , if you use --ts_proto_opt=useExactTypes=false, you should be able to keep the from partial methods, but with simpler types, that won't blow up tsc.

Ideally we'd use an Exact type provided by TS: microsoft/TypeScript#12936 but for now we approximate it with a mapped/conditional type that can get expensive.

@stephenh stephenh closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants