Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (protoc-ts-type-gen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
protoc-ts-type-gen
An EXTREMELY OPINIONATED Protoc Plugin for generating TypeScript Declarations from Protocol Buffer schema.
This repository contains a protoc plugin that generates TypeScript declarations
(.d.ts
files) that match the JavaScript output of protoc --js_out=import_style=commonjs,binary
.
This plugin is tested and written using TypeScript 2.7.
This repository is forked from https://github.com/improbable-eng/ts-protoc-gen/
Installation / Usage
As a prerequisite, download or install protoc
(the protocol buffer compiler) for your platform from the github releases page or via a package manager (ie: brew, apt).
For the latest stable version of the ts-protoc-gen plugin:
npm install protoc-ts-type-gen
Run protoc and reference this library as a plugin:
protoc \
--plugin="protoc-gen-ts=node_modules/.bin/protoc-ts-type-gen" \
--ts_out="${OUT_DIR}" \
your proto files
Gotchas
By default the google-protobuf library will use the JavaScript number type to store 64bit float and integer values; this can lead to overflow problems as you exceed JavaScript's Number.MAX_VALUE
. To work around this, you should consider using the jstype
annotation on any 64bit fields, ie:
message Example {
uint64 bigInt = 1 [jstype = JS_STRING];
}