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

Invalid typescript in descriptor.ts #634

Closed
cirvladimir opened this issue Mar 11, 2024 · 2 comments
Closed

Invalid typescript in descriptor.ts #634

cirvladimir opened this issue Mar 11, 2024 · 2 comments

Comments

@cirvladimir
Copy link

I'm generating proto for a file that uses descriptor.proto, which causes google/descriptor.ts to be generated. However, that file contains invalid typescript, which results in compilation issues.

There are about 10-20 errors in this fashion:

static fromObject(data: {
    file?: ReturnType<typeof FileDescriptorProto.prototype.toObject>[];
}): FileDescriptorSet {
    const message = new FileDescriptorSet({
        file: data.file.map(item => FileDescriptorProto.fromObject(item))
    });
    return message;
}

Note how the file field is nullable, however there is no null check in the function.

@jcready
Copy link
Contributor

jcready commented Mar 11, 2024

This library/code-generator doesn't use .fromObject() or .toObject() so I'm guessing you've filed an issue with the wrong repo.

@timostamm
Copy link
Owner

You can identify code generated by us by this line at the top of the file:

// @generated by protobuf-ts ...

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

3 participants