Symbol missing from generated types
See original GitHub issueCodegen will create typescript definitions that do not include the MESSAGE_TYPE symbol, even though it will be present in all response messages.
Following the example in the manual for this definition:
message Person {
string name = 1;
uint64 id = 2;
int32 years = 3 [json_name = "baz"];
optional bytes data = 5;
}
I would expect that the typescript interface is something like:
import { MessageType, MESSAGE_TYPE } from '@protobuf-ts/runtime';
export interface Person {
/**
* @generated from protobuf field: string name = 1;
*/
name: string;
/**
* @generated from protobuf field: uint64 id = 2;
*/
id: bigint;
/**
* @generated from protobuf field: int32 years = 3 [json_name = "baz"];
*/
years: number;
/**
* maybe a jpeg?
*
* @generated from protobuf field: optional bytes data = 5;
*/
data?: Uint8Array;
// This what's missing
[MESSAGE_TYPE]: MessageType<Person>
}
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Missing import in generated declaration file #49065 - GitHub
Missing import in generated declaration file #49065 ; Bug A bug in TypeScript ; Domain: Declaration Emit The issue relates to the emission...
Read more >QGIS 3 missing symbols - GIS Stack Exchange
If you recently updated your version of QGIS and the default symbol styles were missing, you probably had something go wrong when you ......
Read more >AWS Tutorials: GraphQL build fails on missing symbols and ...
AWS Tutorials: GraphQL build fails on missing symbols and too many ... This is an auto generated class representing the NoteData type in ......
Read more >How to Resolve The Cannot Find Symbol Error in Java - Rollbar
The most common triggers for the cannot find symbol compile-time error include: missing variable and method declarations;; out-of-scope ...
Read more >Compilation error with Clover enabled - missing type, cannot ...
Errors related with a missing symbol might occur when: ... sources are being generated after Clover's instrumentation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, WeakMap is definitely a nice idea. I’ve been using it back in the days in ActionScript and didn’t realize JavaScript implementations finally caught up 😃
Can’t think of any drawbacks. We export both symbols, so it is a breaking change, but it seems worth it for a new major.
@timostamm I wonder if we could avoid the whole mess of extra properties on the objects by using a
WeakMap
to store the message type (and possibly the unknown fields). Something to consider for v3.