Port the code generator to TypeScript #159
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This switches the code generator from Go to a TypeScript implementation. There are only very minor changes in the generated code, and some API related to reflection.
New features
createDescriptorSet()provides a nice way to inspect a set of google.protobuf.FileDescriptorProtoBreaking changes
class TypeRegistryis deprecated. Please usecreateRegistry()instead.class DescriptorRegistryhas been replaced bycreateRegistryFromDescriptors(). The old version is still available asclass LegacyDescriptorRegistryclass DescriptorSethas been replaced bycreateDescriptorSet(). The old version is still available asclass LegacyDescriptorSet.makeEnum(),setEnumType()andmakeEnumType()have changed slightly for improved enum value names.Changes in generated code
Imported names are now sorted case-insensitively:
Uint8Array literals drop the trailing comma:
Float and double literals do not use the exponential notation anymore:
Whitespace in comments is treated slightly different in some edge cases:
Prefixed enum values are now stripped more consequently:
export enum BufAlphaRegistryV1Alpha1UserState { /** * @generated from enum value: BUF_ALPHA_REGISTRY_V1_ALPHA1_USER_STATE_UNSPECIFIED = 0; */ - BUF_ALPHA_REGISTRY_V1_ALPHA1_USER_STATE_UNSPECIFIED = 0, + UNSPECIFIED = 0,In generated JavaScript, stripped enum value names are now passed explicitly instead of deriving them: