Matt Pocock(@mattpocockuk) 's Twitter Profileg
Matt Pocock

@mattpocockuk

Full-time TypeScript educator. Ex-@vercel, @statelyai. Used to be a voice coach. He/him. Author of Total TypeScript πŸ§™ Hire me to teach your team TypeScript!

ID:346640777

linkhttps://totaltypescript.com calendar_today01-08-2011 16:08:26

19,6K Tweets

140,7K Followers

579 Following

Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

Since you all enjoyed talking about template literal types yesterday, let's do another one.

What have you used mapped types for in your app code?

type Mapped = { [K in keyof Obj]: T };

account_circle
Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

What do you use template literal types for in TS?

I'm talking types, like:

type Route = `/user/${string}`;

I'm having a mental block and can only think of routes.

account_circle
David K 🎹(@DavidKPiano) 's Twitter Profile Photo

πŸͺ Excited to announce XState Store!

β†’ Extremely simple API
β†’ Extremely small (< 1kb min/gzip)
β†’ XState-compatible (if you need the power)
β†’ Extra strong typing (inferred!)

npm i @xstate/store

πŸͺ Excited to announce XState Store! β†’ Extremely simple API β†’ Extremely small (< 1kb min/gzip) β†’ XState-compatible (if you need the power) β†’ Extra strong typing (inferred!) npm i @xstate/store
account_circle
Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

It's one of those days. I'm absolutely stonking through work that felt really hard 2-3 weeks ago.

I hope you're having one of these days too. Feels great.

account_circle
Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

strict: true,
noUncheckedUndexedAccess: true,

...tend to be as strict as I go in a tsconfig.

Which rules am I missing out on?

account_circle
Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

TS Wizards:

Is there any reason not to turn `esModuleInterop` on in your tsconfig.json?

Why hasn't it been made the default?

account_circle
Matt Pocock(@mattpocockuk) 's Twitter Profile Photo

Feels like every few months I get a cascade of likes for reminding people this is a thing:

namespace NodeJS {
interface ProcessEnv {
MY_VAR: string;
}
}

So, here's an article - which also recommends t3-env as an awesome runtime solution.

totaltypescript.com/how-to-strongl…

account_circle
David Blass(@ssalbdivad) 's Twitter Profile Photo

`skipLibCheck` being off by default in TypeScript is utterly confounding:

🀷 You probably don't own the code being checked
🚨 Errors may be unresolvable due to tsconfig differences
🐌 Very expensive for type check performance

Do any other languages have something like this?

account_circle