Registry / devops / grpc-ts

grpc-ts

JSON →
library0.0.48jsnpmunverified

grpc-ts is a CLI tool and library for generating TypeScript type definitions from gRPC service definitions (.proto files). It provides both a command-line interface and a programmatic API. As of v0.0.48, the project appears to be in early development with limited releases and no recent updates. It differentiates by offering a straightforward conversion of proto files to TypeScript interfaces, but lacks the ecosystem maturity of alternatives like protobuf-ts or protoc-gen-ts.

npm install grpc-ts
INSTALL
IMPORT
SIG · GRPC-TS
G
grpc-ts
devopsjavascriptv0.0.48
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grpc-ts CLI
npx grpc-ts -i input.proto -o output/
npm run grpc-ts
Since v0.0.48, CLI should be invoked via npx or global install.
Programmatic API (generate)
import { generate } from 'grpc-ts';
const { generate } = require('grpc-ts');
The package is ESM-only; CommonJS require will fail.
generate options
generate({ input: 'file.proto', output: './types' })
generate({ inputFile: 'file.proto', outDir: './types' })
Options property names differ from CLI flags.

Shows programmatic usage to generate TypeScript definitions from a .proto file.

import { generate } from 'grpc-ts'; generate({ input: 'path/to/service.proto', output: './generated' }).then(() => { console.log('TypeScript definitions generated'); }).catch(err => { console.error(err); });
Debug
Known issues
deprecatedThe CLI flag '--input' and '--output' have been deprecated; use '-i' and '-o' instead as of v0.0.40.
fix
Use npx grpc-ts -i input.proto -o output/
affects: <0.0.40
breakingThe programmatic API changed from synchronous to Promise-based in v0.0.30; old code calling generate() without await will not work.
fix
Use async/await or .then() when calling generate().
affects: >=0.0.30
gotchaProtobuf nested types may generate incorrect TypeScript in versions <0.0.42; enum and message names might collide.
fix
Upgrade to v0.0.42+ or manually rename colliding types.
affects: <0.0.42
deprecatedSupport for Node.js <12 was removed in v0.0.45.
fix
Upgrade Node.js to v12 or later.
affects: >=0.0.45
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
The package is ESM-only but project is using CommonJS (require).
fix
Switch to ESM by setting type: module in package.json or use dynamic import: const { generate } = await import('grpc-ts');
Error: The input file 'service.proto' does not exist
Outdated CLI flag usage (--input instead of -i) or incorrect file path.
fix
Use npx grpc-ts -i service.proto -o ./out
TypeError: generate is not a function
Importing wrong export from the package (e.g., named vs default).
fix
Use import { generate } from 'grpc-ts'; (named export).
Upgrade
Version history
0.0.48latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
grpc-ts — npm install grpc-ts · libregistry