Translation
Typed Python, written as TypeScript. And back.
The two languages closest to each other get the closest translation:
list[str] is string[], dict[str, int] is
Record<string, number>, Optional[T] is
T | null, a @dataclass is an interface, an
f-string is a template literal, a comprehension is a .filter() chain,
and await means the same thing in both. Seven languages pass through
one shared meaning: Rust, Go, Java, Python, TypeScript, Zig and Bash. So each of
the forty-two ordered pairs joins a reader to a writer, instead of needing a
translator of its own.
Generated Every result below records what
fr translate produced, captured by
cargo test --test site_data. The first two carry
nothing over as a comment in either direction, the strongest
claim any pair in this tool makes. The rest are real code from real projects, and
they name the point where the translation stops being one. Zig sits at the far end
of the range: no new, no exception, no interpolated string and no
block comment at all. The Next.js route crosses differently again, preserving an
API contract rather than a signature.
What the tool promises
The signature is the contract. Every parameter crosses in order, with its type and the return type, and only the spelling changes, to the target's convention. Where a type has no counterpart, the tool writes it through by name and counts it. Substituting a type quietly makes a signature stop meaning what it said.
Names take the target's convention, and only the file's own.
user_create is userCreate in TypeScript, at its
declaration and at every use. The tool leaves a name the module does not declare,
such as db.users.find or any library function, as written, because
re-casing it would rename somebody else's API.
Nothing goes missing quietly. Ownership, decorators, generators, destructuring and error propagation have no general translation, and a guess would be worse than a gap. The tool carries each into the output verbatim, inside a comment, under a marker, and counts it in the report. You finish the file it hands back, instead of diffing it against the original to learn what went missing.
Where it stops
It is not a compiler, and the result is a draft. The FastAPI backend at the bottom shows the limit. Five of its five signatures mention types from libraries this tool has never heard of, and Python's keyword-only parameters have no TypeScript spelling at all. So the types cross, and the report says that callers will write the call differently. That sentence is worth more than a silently plausible file.