loading words...

Jan 04, 2019 07:48:39


by @swizecteller | 200 words | 🐣 | 116💌

Swizec Teller

Current day streak: 0🐣
Total posts: 116💌
Total words: 32303 (129 pages 📄)

Today I went through the TypeScript 5 minute starter guide. @swyx says TypeScript is all the rage now and he knows his shit.

Here's what I found 👇#200wordsTIL

Raw JavaScript works as TypeScript. You can switch to TS without changing any of your code. 👍

TypeScript uses the same syntax type annotations as Adobe's Flex did back in the dark ages  👉 variable: type

Most languages do it the other way around. Is this better? Does it have a technical reason? I'd love to know. Who can we ask?

Maybe people working on Flex at Adobe moved to Microsoft to invent TypeScript? 🤔

Interfaces let you define object shapes. No more wondering whether you're passing correct-looking blobs of properties. TypeScript can verify it for you. You can nest that stuff too.

This is great. Biggest source of bugs in my code 👌

Interfaces alone make TS worth it.

Prefix class constructor arguments with "public" and the compiler turns them into properties. Nice gimmick but meh.

TypeScript provides editor- and compile-time checks only. 

No runtime guarantees, your code compiles to normal JavaScript. Good because there's no performance hit, bad because runtime checks are important when you talk to APIs and such.

Originally published at twitter.com

contact: email - twitter / Terms / Privacy