/pb-to-typescript

A converter from pb to typescript

Primary LanguageTypeScriptMIT LicenseMIT

pb-to-typescript

license

Intro

A converter to transform from Protobuf to Typescript definition files, which is inspired by geotho/protobuf-to-typescript. However, this converter is powered by protobuf.js, which is more tend to regularity and principle.

Protobuf is currently used in micro-service for back end. As a front end web developer, you can generate Typescript defination files based on Protobuf in case to develop your web page easily.

Usage

import { parseProto } from 'pb-to-typescript';

const source = `
syntax = "proto3";
message MyRequest {
  string path = 1;
}
`;

const ts = parseProto(source);

The result is as follow.

interface MyRequest {
  path: string;
}

Demo

Live Demo

License

MIT