A TypeScript to Nim transpiler that converts TypeScript source code (and JavaScript via TypeScript ESTree) into valid, pretty Nim code. The 0.0.31 release is currently in early development with limited semantic analysis; it focuses on syntax translation and basic type mapping (e.g., number→float, Array→seq, null→nil). The tool also generates wrapper code from .d.ts files using importcpp pragmas. Compared to alternatives like dts2nim, ts2nim directly translates full TypeScript sources rather than just type definitions. It is intended to expand Nim's JavaScript backend ecosystem by reusing existing TypeScript/JavaScript libraries. Note that the project does not resolve dependencies and requires manual post-translation adjustments.
npm install ts2nimNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic usage: transpile a simple TypeScript function to Nim using the default API.
Manually import and translate required modules, or use .d.ts files for wrapper generation.
Manually adjust number types in generated Nim code.
Refactor TypeScript classes to avoid multiple inheritance, or use composition instead.
Review generated Nim code for rest parameters and adjust types as needed.
Add import asyncdispatch or import asyncjs to the top of generated Nim file.
Run npm install ts2nim and use correct import: import ts2nim from 'ts2nim'.
Use import ts2nim from 'ts2nim' and call ts2nim.transpile().
Manually review and fix the generated Nim code, especially around function signatures and type casts.
In the CLI, use --declaration flag or set mode: 'declaration' in programmatic API.
No dependency data recorded yet.