
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
@chasdevs/avro-to-typescript
Advanced tools
Package for converting Avro schema files (.avsc) to TypeScript class files
Forked from @degordian/avro-to-typescript
avro-to-typescript compiles avro schema files (.avsc) to TypeScript classes and interfaces. Making using avro schematics with node.js easy and comfortable.
This fork removes the schema registry and node-rdkafka dependencies for a lighter-weight install.
Most projects will use avro-to-typescript this way
npm install -g @chasdevs/avro-to-typescript
avro-to-typescript --compile [ schema-directory ] [ output-directory ]
This will generate namespaced folders and files for your schemas inside output directory so have that in mind.
You also need to install avro-to-typescript in your project.
npm install @chasdevs/avro-to-typescript --save
This way is if your projects needs to generate avro classes while running.
npm install @chasdevs/avro-to-typescript --save
import { Compiler } from "chasdevs/avro-to-typescript";
const compiler = new Compiler(outputDir);
await compiler.compile(avro);
If you want to take advantage of logical types, you can pass these as an argument to the cli
avro-to-typescript --compile [ schema-directory ] [ output-directory ] --logical-types [avro type] [typescript type]
You can even pass more than one if you alternate them:
avro-to-typescript --compile [ schema-directory ] [ output-directory ] --logical-types [avro type] [typescript type] [avro type] [typescript type]
You can also pass them to the compiler in your code directly:
import { Compiler } from "chasdevs/avro-to-typescript";
const compiler = new Compiler(outputDir, { date: 'string', 'timestamp-millis': 'string'} });
await compiler.compile(avro);
If there are logical types in the avro schema but you don't provide a mapping for them, they will default to the underlying primitive type.
If you are having issues, please let us know on our issue tracker.
The project is licensed under the MIT license.
FAQs
Package for converting Avro schema files (.avsc) to TypeScript class files
The npm package @chasdevs/avro-to-typescript receives a total of 4,193 weekly downloads. As such, @chasdevs/avro-to-typescript popularity was classified as popular.
We found that @chasdevs/avro-to-typescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.