DEV Community

Cover image for Why I Rewrote type-tune from TypeScript to Rust ๐Ÿฆ€
nyaomaru for Necoz

Posted on AI-assisted

Why I Rewrote type-tune from TypeScript to Rust ๐Ÿฆ€

Inspired by a DHH video to port 20k lines

Hoi hoi! ๐Ÿ‘‹

I'm @nyaomaru, a frontend engineer who loves TypeScript and gambas, not crabs! ๐Ÿฆ

And yet, somehow, I ended up building a tool in Rust. ๐Ÿ™€๐Ÿฆ€

Recently, I released a new open-source CLI tool called type-tune.

GitHub logo necoz-oss / type-tune

A Rust-powered CLI to find shared TypeScript types and move them safely. ๐Ÿฆ€

type-tune

Animated type-tune logo

Test Docs MIT License

Give shared TypeScript types a better home. ๐Ÿ˜ธ

Scan. Review. Move. Validate.

type-tune is a Rust-powered CLI that finds shared TypeScript type aliases and interface declarations and helps move them without manually chasing imports.

It creates a reviewable plan, updates supported type imports and re-exports, and validates the rewrite with TypeScript. You decide what moves and where.

Guides for installation, the first scan, and the review workflow live in the official documentation. Releases are listed on GitHub Releases, and the package is type-tune on npm.

Why type-tune?

Types often start next to a component or utility, then end up shared across a project. Moving them later means tracking imports, local dependencies, and barrels by hand.

  • Discover shared types with deterministic candidate IDs.
  • Review plan.md and choose the destination before making changes.
  • Rewrite supported type-only imports, aliases, and simple barrels while keeping compatibility re-exports at the originalโ€ฆ

type-tune finds shared TypeScript types and helps move them to a better place without manually updating imports, dependencies, and barrel exports.

But why is a TypeScript tool created by a TypeScript lover written in Rust? ๐Ÿค”


๐Ÿˆ It All Started with TypeScript

Naturally, the original implementation of type-tune was written in TypeScript.

It was already complete by September, with nearly 20,000 lines of TypeScript, including tests, comments, and blank lines.

Around that time, I happened to watch this video by DHH.

I didn't agree with everything, but I particularly liked the idea of taking advantage of this era to pursue things that genuinely excite us.

Of course, outside of personal projects, I don't think we can simply hand everything over to AI. Someone still needs to understand and maintain the software.

But while watching the video, a simple thought crossed my mind.

If it's possible to go from Rails to Rust, why not TypeScript to Rust? ๐Ÿฆ€


๐Ÿฆ€ From TypeScript to Rust

I already had a working implementation, design documents, tests, and well-defined TypeScript types.

For example, translating a data model like this:

type CandidateKind = "typeAlias" | "interface";

type Candidate = {
  id: string;
  name: string;
  kind: CandidateKind;
  referrers: string[];
};
Enter fullscreen mode Exit fullscreen mode

Into something like this:

enum CandidateKind {
    TypeAlias,
    Interface,
}

struct Candidate {
    id: String,
    name: String,
    kind: CandidateKind,
    referrers: Vec<String>,
}
Enter fullscreen mode Exit fullscreen mode

Of course, migrating the entire application involved much more than translating type definitions.

But having an existing design and implementation made it much easier.

With the help of AI, I completed the migration in less than a month while working on it as a side project.

The results were satisfying ๐Ÿ˜ป

  • Better execution performance.
  • Native binary distribution.
  • No Rust development environment required for npm users.

You can still install type-tune like any other familiar TypeScript development tool.

pnpm add -D type-tune
Enter fullscreen mode Exit fullscreen mode

The npm launcher requires Node.js 22+, but the core implementation runs as a native binary.

So far, so good!

Except for one little problem. ๐Ÿ˜ฟ


๐Ÿ™€ type-tune Got Faster. Its Developer Got Slower.

I barely knew Rust. ๐Ÿ˜น

I'm comfortable reviewing AI-generated TypeScript code, but with Rust, I'm still learning the fundamentals.

For example, consider ownership and borrowing.

In TypeScript, this is perfectly fine:

function printName(name: string) {
  console.log(name);
}

const name = "OrderSummary";

printName(name);
console.log(name); // OK
Enter fullscreen mode Exit fullscreen mode

However, a similar implementation in Rust doesn't compile.

fn print_name(name: String) {
    println!("{}", name);
}

fn main() {
    let name = String::from("OrderSummary");

    print_name(name);
    println!("{}", name); // Error: value borrowed after move
}
Enter fullscreen mode Exit fullscreen mode

The ownership of name is transferred to print_name.

One way to fix this is to borrow the value instead.

fn print_name(name: &str) {
    println!("{}", name);
}

fn main() {
    let name = String::from("OrderSummary");

    print_name(&name);
    println!("{}", name); // OK
}
Enter fullscreen mode Exit fullscreen mode

Another option is to clone the value.

print_name(name.clone());
println!("{}", name); // OK
Enter fullscreen mode Exit fullscreen mode

Both solutions compile, but cloning unnecessarily can introduce additional allocations.

So when AI generates a .clone(), I need to understand whether it's actually necessary or whether borrowing would be more appropriate.

The same applies to visibility boundaries.

For example, making an internal helper public might solve an accessibility issue:

pub fn resolve_destination() {
    // ...
}
Enter fullscreen mode Exit fullscreen mode

But if the function is only used within the same crate, exposing it publicly may be unnecessary.

pub(crate) fn resolve_destination() {
    // ...
}
Enter fullscreen mode Exit fullscreen mode

And if it's only used within its own module, it can remain private.

fn resolve_destination() {
    // ...
}
Enter fullscreen mode Exit fullscreen mode

The compiler accepts all three declarations, but each represents a different architectural decision.

I'm also still learning when macros are appropriate and when ordinary functions are sufficient.

AI can generate code that compiles, but I still need to understand whether its design choices are appropriate.

In TypeScript, I can make these decisions relatively quickly. In Rust, I often need to stop and learn something before continuing my review.

AI can generate Rust code much faster than I can understand it.

I wanted to accelerate the development of my side project, but I introduced a new bottleneck.

Myself.

What a wonderful optimization! ๐Ÿ˜น


๐ŸŽจ Creating Without Learning

Of course, I could just vibe code.

I could keep pressing Enter whenever AI asks for approval and probably release features faster.

But for me, creating something without learning anything is just another task.

And I believe that if I keep doing nothing but those tasks, I'll gradually lose my ability to create.

I enjoy using AI to learn unfamiliar concepts and explore new approaches.

But I don't want to spend my time simply producing things without understanding them.

I don't want to become a very expensive Enter key. ๐Ÿ˜น

Do I regret choosing Rust?

Not at all!

It was a valuable experience, and I'm grateful that we live in a time when we can challenge ourselves like this so easily.

Now, let's talk about what I actually built!


๐Ÿ› ๏ธ The Design Behind type-tune

One architectural decision remained unchanged throughout the migration.

Scan / Plan / Apply

Consider a typical TypeScript project.

src/
โ”œโ”€โ”€ features/
โ”‚   โ”œโ”€โ”€ orders/
โ”‚   โ”‚   โ””โ”€โ”€ order-page.ts
โ”‚   โ”œโ”€โ”€ dashboard/
โ”‚   โ”‚   โ””โ”€โ”€ dashboard.ts
โ”‚   โ””โ”€โ”€ reports/
โ”‚       โ””โ”€โ”€ reports.ts
Enter fullscreen mode Exit fullscreen mode

Initially, a type belongs to the orders feature.

// features/orders/order-page.ts

export type OrderSummary = {
  id: string;
  total: number;
};
Enter fullscreen mode Exit fullscreen mode

But as the application grows, other features start importing it.

// features/dashboard/dashboard.ts

import type { OrderSummary } from "../orders/order-page";

export function calculateRevenue(orders: OrderSummary[]) {
  return orders.reduce((sum, order) => sum + order.total, 0);
}
Enter fullscreen mode Exit fullscreen mode
// features/reports/reports.ts

import type { OrderSummary } from "../orders/order-page";

export function createReport(order: OrderSummary) {
  return `${order.id}: ${order.total}`;
}
Enter fullscreen mode Exit fullscreen mode

The type is still useful, but its original location may no longer be appropriate.

Tools like Knip help us remove unused code.

type-tune tackles a different problem: reorganizing types that are still in use.


๐Ÿ” 1. Scan

pnpm exec type-tune scan --project tsconfig.json
Enter fullscreen mode Exit fullscreen mode

type-tune analyzes exported type aliases, interfaces, references, and relevant dependencies to identify potential extraction candidates.

No source code is modified.


๐Ÿ“‹ 2. Plan

Finding a type that can be moved doesn't necessarily mean it should be moved.

That's why type-tune generates a reviewable plan.

pnpm exec type-tune plan \
  --project tsconfig.json \
  --out .type-tune/plan.json \
  --markdown .type-tune/plan.md
Enter fullscreen mode Exit fullscreen mode

It generates two files:

  • plan.json โ€” Candidate metadata and validation information.
  • plan.md โ€” A human-readable, editable plan.

Every candidate is ignored by default.

Here's a simplified example of plan.md:

- [ignore] <candidate-id> `OrderSummary`
  - kind: `typeAlias`
  - from: `src/features/orders/order-page.ts`
  - to: `src/features/orders/types/order.ts`
Enter fullscreen mode Exit fullscreen mode

You can approve the candidate and customize its destination.

- [ignore] <candidate-id> OrderSummary
+ [apply] <candidate-id> OrderSummary
    - kind: typeAlias
    - from: src/features/orders/order-page.ts
-   - to: src/features/orders/types/order.ts
+   - to: src/domains/orders/types/order-summary.ts
Enter fullscreen mode Exit fullscreen mode

Perhaps it belongs in a shared directory, a domain-specific module, or exactly where it is now.

That's an architectural decision.

You decide what moves and where.


๐Ÿšš 3. Apply

Preview the selected changes:

pnpm exec type-tune apply \
  --plan .type-tune/plan.json \
  --markdown .type-tune/plan.md \
  --dry-run
Enter fullscreen mode Exit fullscreen mode

Then apply them:

pnpm exec type-tune apply \
  --plan .type-tune/plan.json \
  --markdown .type-tune/plan.md
Enter fullscreen mode Exit fullscreen mode

The resulting project structure:

src/
โ”œโ”€โ”€ domains/
โ”‚   โ””โ”€โ”€ orders/
โ”‚       โ””โ”€โ”€ types/
โ”‚           โ””โ”€โ”€ order-summary.ts  โ† Moved!
โ””โ”€โ”€ features/
    โ”œโ”€โ”€ orders/
    โ”‚   โ””โ”€โ”€ order-page.ts
    โ”œโ”€โ”€ dashboard/
    โ”‚   โ””โ”€โ”€ dashboard.ts
    โ””โ”€โ”€ reports/
        โ””โ”€โ”€ reports.ts
Enter fullscreen mode Exit fullscreen mode

The type now lives in its new home.

// domains/orders/types/order-summary.ts

export type OrderSummary = {
  id: string;
  total: number;
};
Enter fullscreen mode Exit fullscreen mode

Supported imports are updated automatically.

- import type { OrderSummary } from "../orders/order-page";
+ import type { OrderSummary } from "../../domains/orders/types/order-summary";
Enter fullscreen mode Exit fullscreen mode

And the original module retains a compatibility re-export.

// features/orders/order-page.ts

export type { OrderSummary } from "../../domains/orders/types/order-summary";
Enter fullscreen mode Exit fullscreen mode

type-tune also validates the rewrite using the TypeScript compiler and rolls back changes if normal validation fails.

You should still review the resulting diff and run your project-specific tests and builds.


๐Ÿงฉ Automate the Work, Not the Decisions

Why separate Scan, Plan, and Apply?

Because discovering opportunities, making architectural decisions, and executing changes are different responsibilities.

type-tune even supports optional AI-assisted review:

pnpm exec type-tune plan \
  --project tsconfig.json \
  --ai-review \
  --ai-dry-run
Enter fullscreen mode Exit fullscreen mode

AI can provide additional review notes, but it doesn't control the source code rewrite. The command above previews the AI review request without contacting a provider.

Interestingly, this is also how I want to work with AI in my own development.

Automate the tedious work without taking architectural decisions away from developers.

That's the philosophy behind type-tune.


๐Ÿ’š Give Your TypeScript Types a Better Home!

You can start by simply scanning your project.

npx type-tune scan --project tsconfig.json
Enter fullscreen mode Exit fullscreen mode

No need to move anything yet. Just see what you find! ๐Ÿ˜ธ

GitHub logo necoz-oss / type-tune

A Rust-powered CLI to find shared TypeScript types and move them safely. ๐Ÿฆ€

type-tune

Animated type-tune logo

Test Docs MIT License

Give shared TypeScript types a better home. ๐Ÿ˜ธ

Scan. Review. Move. Validate.

type-tune is a Rust-powered CLI that finds shared TypeScript type aliases and interface declarations and helps move them without manually chasing imports.

It creates a reviewable plan, updates supported type imports and re-exports, and validates the rewrite with TypeScript. You decide what moves and where.

Guides for installation, the first scan, and the review workflow live in the official documentation. Releases are listed on GitHub Releases, and the package is type-tune on npm.

Why type-tune?

Types often start next to a component or utility, then end up shared across a project. Moving them later means tracking imports, local dependencies, and barrels by hand.

  • Discover shared types with deterministic candidate IDs.
  • Review plan.md and choose the destination before making changes.
  • Rewrite supported type-only imports, aliases, and simple barrels while keeping compatibility re-exports at the originalโ€ฆ




Feedback, ideas, issues, and contributions are always welcome!

And if you're a Rust developer, please teach this poor TypeScript cat how to become a competent crab. ๐Ÿ˜น๐Ÿฆ€

Small. Simple. Useful. Built Together!

Thank you for reading! ๐Ÿ™Œ๐Ÿ’š

Top comments (41)

Collapse
 
alptekin profile image
alptekin I. •

Hi,
Thanks for sharing this post.
...Which was just on the right time for me. Recently i got some interest in Rust. There are mutiple reasons,

  • usage of rust in the infrastructure of popular web tools / ecosystem like Vite, bun, TS compiler etc. (I have a plan to get in building dev tools, too).
  • recent increase in Rust mentions (dont really wanna call it "hype") promoting mem management and efficiency / swiftness etc. as a better choice of C++ / C and GC consisting languages and also the efficiency of making AI write Rust code, due to its better error messages, etc.
  • some feeling that it would be better to also know a compiled, static and efficient lang, as a career roadmap (in addition to TS/JS and relevant ecosytem/tools etc.)

I also believe that We should know the language that we make AI code for us, I would feel quite uneasy otherwise.

I still did not get into learning Rust, evaluating it still, and nowadays, unfortunately i am very busy or lazy to do some side project/learning at my free time (could not create any).

But hopefully this will change and I will resume learning and building personal stuff soon. And when that time comes, building some tools with Rust and learning it might be a challenge i could assume.

Anyway,
I have a couple of questions for you, if you dont mind:

  1. What you think of next? do you think you will continune with rust development, for this kind of work above and learn it deeply by time?
  2. And are there any more reasons, other than just embracing a challenge that is exciting to get into Rust (if you say yes to my above question) Thanks
Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thanks for the thoughtful comment! ๐Ÿ˜ธ

I actually agree with a lot of what you said, especially this part ๐Ÿ‘‡

We should know the language that we make AI code for us.

I feel the same way. Even if AI can write a lot of the code, I still want to understand what it is doing, why the compiler is complaining, and whether the implementation actually makes sense.

  • For your first question

yes, I think Rust will definitely remain one of my options, especially when I build CLI tools or other developer tools.

I'm still learning Rust myself, so I wouldn't say I've gone very deep yet. But working on type-tune has already given me a pretty good reason to keep learning it.

In my testing, the Rust version of type-tune ended up being almost 10x faster than the TypeScript version in some workloads. For a CLI, that kind of difference directly improves the UX, commands feel much more immediate.

  • your second question

performance isn't the only reason for me.

I also really like that Rust gives you a compiled binary, strong guarantees from the compiler, and very explicit error handling. For tools that touch a lot of files or modify a user's codebase, that safety is especially attractive.

That said, I don't think I'd choose Rust for everything. I still love TypeScript, and for many kinds of applications it is absolutely the better choice.

But for CLI/dev tooling specifically, Rust has definitely become a language I want to keep using and learning more deeply. ๐Ÿฆ€

So if you eventually decide to build a small tool with it, I think that would be a great way to learn, that's basically how I'm learning it too! ๐Ÿ˜ธ

Collapse
 
alptekin profile image
alptekin I. •

Thanks for your detailed response. Agree with all.

when learning something, I mostly prefer to watch a superficial video and start reading the docs or recommended books. When i check the docs. they mention an online book. I kind of feel that i should start with this book, for fundamentals mostly.

In parallel, starting a little project seems a very good idea.

now the hardest part, committing to it and finding time.

Thanks again, see u around.
alptekin

Thread Thread
 
nyaomaru profile image
nyaomaru Necoz •

Absolutely! ๐Ÿ˜ธ

And yeah... finding the time and actually committing to it is probably the hardest part. ๐Ÿ˜น

Thanks again for the great conversation, and see you around! ๐Ÿ’š

Collapse
 
luke_bennett_ed52405c798e profile image
Luke Bennett •

Aqben
Thanks for your reply thank you. They can do the same

Thanks
Luke

Collapse
 
amintacccp profile image
tamina •

The "type-tune got faster, its developer got slower" line is the most honest part of this. AI collapsing the cost of writing Rust while the review cost stays the same is exactly the bottleneck I keep running into too โ€” "compiles and passes tests" doesn't tell me whether the abstraction is right, and the .clone() question is a perfect example of a decision that looks trivial but isn't.

The Scan / Plan / Apply split, with every candidate [ignore] by default, is the design choice I'd steal: it makes the tool's job "surface the decision" instead of "make the decision", and rolling back when tsc validation fails is the safety net that makes apply feel trustworthy rather than scary. Congrats on the release โ€” and on refusing to become a very expensive Enter key.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thank you! ๐Ÿ˜ธ๐Ÿ’š

I really like your phrasing: โ€œsurface the decision instead of make the decision.โ€

Thatโ€™s exactly what I want type-tune to do.

Automate the mechanical work, make the risky parts reviewable, and leave the architectural choice to the developer.

And yes, Iโ€™m still trying very hard not to become an expensive Enter key. ๐Ÿ˜น๐Ÿฆ€

Collapse
 
amintacccp profile image
tamina •

Ha, the expensive Enter key line got me too โ€” and honestly it's the exact tension I keep running into with my own tooling. Automate the mechanical parts, keep the risky parts reviewable. Good luck with the Rust side of it, and thanks for writing the trade-offs up so honestly.

Thread Thread
 
nyaomaru profile image
nyaomaru Necoz •

Thank you! ๐Ÿ˜ธ๐Ÿ’š

That balance is exactly what Iโ€™m trying to keep: automate the mechanical work, but make sure the parts that can actually change the architecture stay visible and reviewable.

And thanks for the encouragement on the Rust side too. I still have a lot to learn, but thatโ€™s part of the fun. ๐Ÿฆ€

Thread Thread
 
amintacccp profile image
tamina •

Exactly โ€” "the parts that can actually change the architecture stay visible" is the perfect way to put it. That's the line I'd draw too: automate the boring bits, keep the decisions that reshape the system in front of human eyes. Enjoy the Rust learning curve, the fun part is real ๐Ÿ˜„

Collapse
 
antonioprosperi2svg profile image
Antonio Necoz • • Edited

"I don't want to become a very expensive Enter key" ๐Ÿ˜น This hit home!

Honestly, I'm not a great developer. I get a lot of help from AI, and just like you said, I use it to understand. I still don't know everything about how my own two projects are built. I tried reading a bit of your Rust code, but I needed AI to explain it to me ๐Ÿ˜…

But I truly believe one thing: you have great skills and great ideas, and they will take you further than AI, because you're the one giving the commands.

For me, writing documentation for my projects is how I learn: I understand them better and I keep finding new bugs to fix... and so on! ๐Ÿฑ๐Ÿฆ€๐Ÿ’š

fn main() {
    let me = String::from("JS cat ๐Ÿฑ");
    ask_ai(&me); // borrowing, not moving! I'm learning ๐Ÿ˜น
    println!("{} still here, still learning ๐Ÿฆ€", me);
}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ˜๐Ÿ˜

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thank you!! I love your comment. ๐Ÿ˜ธ๐Ÿ’š

And honestly, using AI to understand our own code is still learning. What matters is that you keep asking why things work instead of just accepting the output.

Writing documentation is a really good way to do that too. If you can explain the code clearly, you usually understand it much better โ€” and like you said, you often find bugs along the way. ๐Ÿ‘€

Also, your Rust example made me laugh. ๐Ÿ˜น๐Ÿฆ€
The JS cat survived the borrow checker!

Letโ€™s keep learning and building together. ๐Ÿฑ๐Ÿ™Œ

Collapse
 
antonioprosperi2svg profile image
Antonio Necoz •

Thank you so much! ๐Ÿ˜ธ๐Ÿ’š

Collapse
 
sameerqaiser17 profile image
Sameer Qaiser •

The line that hit me: "I don't want to become a very expensive Enter key."

That is the most accurate description of the current AI era I have ever read.

As someone who is currently learning Python, I feel this deeply. It is incredibly easy to just ask an AI to write a script, hit "Accept," and move on. But if you don't understand the why behind the code, you're just accumulating technical debt and learning absolutely nothing.

I also love the Scan / Plan / Apply architecture you built. It perfectly mirrors how we should be using AI. Let the AI automate the tedious scanning and the manual file moves (Apply), but keep the architectural decisions (Plan) in the hands of the human.

I have one question for you: Through this process, do you feel like you actually learned Rust, or did you just learn how to review AI-generated Rust? There's a massive difference between the two, and I'm curious how you feel about it now.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Thatโ€™s a really good question! ๐Ÿ˜ธ

I definitely wouldnโ€™t say "I fully understand Rust" yet.
There are still parts where I need to stop, read the implementation carefully, and sometimes ask for an explanation before I really understand what is happening.

But through actually building type-tune, reviewing the generated code, and going through those explanations almost like mini lectures, I do feel that Iโ€™m gradually learning Rust rather than simply learning how to approve AI-generated Rust.

So for me, the workflow that seems to work best is: let AI help with the implementation, but then slow down during review, read the code carefully, understand why it works, and only move forward once I can explain it to myself.

One important detail in this case is that type-tune already had its basic architecture implemented in TypeScript before I rewrote it. So I already understood what the tool was supposed to do and how the pieces fit together. That made it much easier to focus specifically on how Rust expresses the same ideas.

Iโ€™m still very much learning, but I think that combination of "building + reviewing + understanding" is working pretty well for me so far. ๐Ÿฆ€

Collapse
 
paullovelace profile image
Paul Lovelace •

That line about not wanting to become a very expensive Enter key is the whole thing, isn't it. The clone-vs-borrow review problem is the part that would slow me down most โ€” AI handing you code that compiles but you can't tell if the .clone() is load-bearing. Did the rewrite change how you review AI code in TypeScript too, or is it just the Rust that's slower to check?

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Yeah, Rust is definitely the slower one for me to review. ๐Ÿ˜น

In TypeScript, I can usually spot questionable choices pretty quickly because I already have a strong mental model for the language and ecosystem.

But the Rust rewrite did make me more suspicious of AI-generated code in TypeScript too.

โ€œCompilesโ€ and โ€œpasses testsโ€ are useful signals, but they still donโ€™t tell me whether the abstraction, API boundary, dependency direction, or ownership of responsibility is actually right.

So Rust mostly slowed down the review itself, but it probably made my TypeScript reviews a bit more skeptical too. ๐Ÿ‘€

And yeah, the .clone() question is exactly the kind of thing that makes Rust review take longer for me. ๐Ÿฆ€

Collapse
 
kursatyz profile image
KรผrลŸat Yฤฑlmaz •

Memory safety and zero-cost abstractions only deliver their promise when you understand the underlying cache hierarchy and syscall overhead.

Rewriting services without profiling memory allocation patterns just trades one set of bottlenecks for another. Systems engineering always comes down to mechanical sympathy with the hardware.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Absolutely. ๐Ÿ‘€

Thatโ€™s also why Iโ€™m trying not to frame the rewrite as simply โ€œRust made it faster.โ€

The Rust version changed more than the language itself:
parser choice, reference analysis, data structures, and execution strategy all changed too.

In controlled benchmarks it is clearly much faster, but profiling the real bottlenecks still matters if I want to understand why.

Otherwise Iโ€™m just moving the bottleneck somewhere else. ๐Ÿ˜น๐Ÿฆ€

Collapse
 
gtref profile image
G-type Necoz • • Edited

I am going to ask you 1 thing. where on this planet, earth and sky did you learn rust. It still manages to elude me to this day. and so i got the unholy deity AI to teach me slowly. also,

May the fluff be with you

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

I didnโ€™t really โ€œlearn Rust first and then build it.โ€ I built it while learning Rust, with AI acting as my very patient tutor. ๐Ÿ˜น๐Ÿฆ€

So Iโ€™m still learning too. ๐Ÿ‘€

And yes,
May the fluff be with you. ๐Ÿˆโœจ

Collapse
 
c-wind profile image
c-wind •

Keeping the original module as a compatibility re-export is a good safety valve. One edge Iโ€™d be curious about: with project references or path aliases, does apply validate only the selected --project, or walk the referenced configs too? A leaf config can pass while a consumer still resolves the old path differently.

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Good catch. ๐Ÿ‘€

Right now, type-tune does not walk TypeScript project references.

If the selected tsconfig has non-empty references, scan/plan/apply are rejected before any rewrite happens. Path aliases are supported, but final validation still runs against the selected --project only.

So your leaf-config example is exactly why I donโ€™t want to claim workspace-wide safety yet.

Supporting the full project-reference graph will need a broader analysis/validation model rather than just following references during apply. ๐Ÿฆ€

Collapse
 
aheadkit profile image
AheadKit •

The line about AI generating Rust faster than you can understand it is the most honest thing I've read about agents in weeks. You optimised the typing and accidentally made yourself the bottleneck. I did the same dance with a language I barely knew once and spent more time reading the generated code than I would've spent writing the slow version myself. Still worth it for the learning, or would you pick the boring familiar stack next time and keep the speed?

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

I think it depends a lot on the size of the project and what Iโ€™m trying to achieve. ๐Ÿ˜ธ

If I need to ship something quickly and maintain it for a long time, Iโ€™d probably still choose TypeScript because thatโ€™s where Iโ€™m fastest and most comfortable.

If performance really matters, or I specifically want the challenge, then Iโ€™d choose the language that fits that goal better.

What this rewrite changed for me is that Iโ€™m much less afraid of rewriting something later.

But even with Rust, I probably wouldnโ€™t start from zero there. Iโ€™d likely build the first version in TypeScript, get the design and behavior right, and then rewrite once I actually understand what needs to change.

That path feels much more natural for me now. ๐Ÿฆ€

Collapse
 
vidakhoshpey22 profile image
Vida Khoshpey •

omg i gave you star and followed you i loved it so cute ๐Ÿ˜๐Ÿ˜

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

YAY!!! ๐Ÿ˜ธ๐Ÿ’š
Thank you so much for the star and the follow!!

Iโ€™m really happy you liked it. ๐Ÿˆ๐Ÿฆ€โœจ

Some comments may only be visible to logged-in visitors. Sign in to view all comments.