Javascript To Typescript

preview_player
Показать описание
Recorded live on twitch, GET IN

Become a backend engineer. Its my favorite site

This is also the best way to support me is to support yourself becoming a better backend engineer.

MY MAIN YT CHANNEL: Has well edited engineering videos

Discord

Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
Рекомендации по теме
Комментарии
Автор

developer streamers just using ms paint is a yt shorts genre

Ikxi
Автор

You just described everything I was about to write, leverage JSDoc and keep everything lean

mirceastaicu
Автор

What i did to migrate my project from JS to TS was simply dedicate a few days, change all file extensions to .ts instead of .js, and start fixing all the errors that pop up

sammy
Автор

This is actually a really good idea, basically soft-type hinting. In PHP we have type hints but we also have PHPDocs that act as soft hints and then tools like PHPStan can highlight problems based off those soft hints or type hints.

notanactualuser
Автор

If you need an entire devops team just to compile TypeScript, you're doing it wrong. Use allowJS and adopt it gradually. If planning to use it for brownfield JS projects, I would consider doing it only in the sections you touch the code, not the entire app.

MeriadocTook-zubm
Автор

yeah, you probably won't have an entire build team, the most likely thing what is going to happen is that you suddenly discover a ton of bugs that could have been prevented by TS and you have an entire team that suddently has to fix all of those old bugs that they never wanted to fix

borgfriend
Автор

I would pay for a course that breaks this process down, or even distilled curated resources to attempt this. My team is vehemently against typescript, but my boss is slowly coming around to the idea that we will have to migrate our seven-year-old JS codebase over to typescript at some point. I would love some gotchas and pointers

Ecthyr
Автор

I tried switching from TS to JS multiple times for that lightweight feel. It never works out and I always have to go back to TS

StabilDEV
Автор

Have you ever tried this for real? I did on a 1M lines code base. I does not work well. Js docs are not the same as TS. Since everybody is probably using webpack anyways, it's just adding ts loader and tsconfig to make ts work.

gabrielmachado
Автор

Precisely what I do, but because TypeScript edge case compile errors forced my hand. Had enough and haven't looked back.. jsdocs are great. (I've since moved on to GO as my main language though)

valethemajor
Автор

Recent years I prefer to use just a simple JSDoc where possible, instead of transpiling my codebase and in the end messing around with types more, than with my actual code. Sure I have some really big projects, where proper typescript code is actually irreplaceable. Aside that, JSDoc is good enough for something less monumental. The right tools for the right job.

dansadler
Автор

Your MOM has a big codebase, filled with javascript

blarghblargh
Автор

Please make a full length video about this

gregroyclark
Автор

I totaly dont understand what he is talkin about, but this guy has charisma.

halcyon__r
Автор

This might work for very small projects or greenfields, but it would be a really dumb idea for brownfields or mature projects. It's just NOT WORTH the hassle for the benefits. Might as well keep the JS project and start a new TS project that "copies" it.

ForgottenKnight
Автор

JSDoc is awesome, but it's not the same as TS. You can't just go "as const" or "satisfies" in JSDoc.

juliohintze
Автор

Wait for JS to add type annotations and 99% of typescript usecases becomes obsolete.

RealRatchet
Автор

Yeah moving from JS to TS just really isn’t that hard. Having types inline with the code just makes more sense too rather than in some weird JSDoc comments all over the place. Vite, Next.js, esbuild, and SWC all support TypeScript right out of the box for transpilation, and there’s ts-loader for Webpack. It’s not difficult to make the actual “type checking” as part of your tests too if you don’t want that process affecting your devserver iteration speed

gregoryjacobs
Автор

Entire build team? What?.. You just add the tsconfig file and add a couple of dependencies in the package and that's about it. JSDoc is not a replacement for TS, it's not a complete typing system. It's just annotations that integrate nicely with the IDE but not nearly at the same level as TS and it doesn't help catching errors outside of runtime. And with Bun you don't need to set up anything. Just run bun init and off you go.

daniels
Автор

allowjs is the move. my approach for projects was to ignore tech media dogma and incrementally adopt ts. its okay for 95% js and 5% ts... if the alternative was 100% js and prayers.

crowdozer