ksm2 / protoc-gen-typescript

TypeScript generator plugin for Protoc written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

protoc-gen-typescript

A code generator for TypeScript based on Protobuf definitions, written in Rust.

Table of Contents

Features

  • Generates well-formatted, easy to read and extendable TypeScript code
  • Generated code only depends on 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

About

TypeScript generator plugin for Protoc written in Rust

License:MIT License


Languages

Language:Rust 56.2%Language:TypeScript 42.9%Language:Batchfile 0.5%Language:Shell 0.4%