https://github.com/ksm2/protoc-gen-typescript
TypeScript generator plugin for Protoc written in Rust
https://github.com/ksm2/protoc-gen-typescript
protobuf protobuf-plugin typescript
Last synced: about 1 month ago
JSON representation
TypeScript generator plugin for Protoc written in Rust
- Host: GitHub
- URL: https://github.com/ksm2/protoc-gen-typescript
- Owner: ksm2
- License: mit
- Created: 2023-02-27T19:29:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-06T17:08:25.000Z (almost 3 years ago)
- Last Synced: 2025-03-27T13:47:06.925Z (about 1 year ago)
- Topics: protobuf, protobuf-plugin, typescript
- Language: Rust
- Homepage:
- Size: 164 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
protoc-gen-typescript
=====================
A code generator for TypeScript based on Protobuf definitions, written in Rust.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
## Features
- Generates well-formatted, easy to read and extendable TypeScript code
- Generated code only depends on [`google-protobuf`](https://www.npmjs.com/package/google-protobuf)
- Supports all field types
- Generates service stubs
- Generates enums
- Allows using `String`, `Number` or `BigInt` for 64-bit integers
- Enhanced integrations for `google.protobuf.Timestamp` and `google.protobuf.Duration` with JavaScript `Date`
- Support for packed and unpacked fields
- Generated code is fully tested using Jest
## Installation
Install the application using [Cargo]:
cargo install --path .
This will place the `protoc-gen-typescript` binary by default in your `~/.cargo/bin` folder.
If you have that folder inside your path, you should be able to find it using
which protoc-gen-typescript
## Usage
Using [Protoc] you can now convert your Protobuf definitions into TypeScript:
mkdir -p gen
protoc --typescript_out=gen --proto_path=include include/*.proto
[Cargo]: https://doc.rust-lang.org/cargo/
[Protoc]: https://grpc.io/docs/protoc-installation/