Video Feed
TypeScript Compiler: Solving problems | Gal Schlezinger

0
TypeScript
04.26.2020

English

Gal Schlezinger

“Here’s a simple coding task,” the interviewer says — “You can use any language you want”. “Any language..?”, I smirked. Little did he know that TypeScript’s type system is Turing complete...
Watch Gal reveal how to solve FizzBuzz in the type system itself, by getting the solution with no runtime code whatsoever!
TypeScript’s type system is very powerful and can express very exciting things. This technical-yet-humorous talk is done almost entirely hands-on, in an editor, inside a .d.ts file. By using a certain amount of generics, recursive types, and conditional types, we code together:
type FizzBuzzNth that resolves into a literal of “Fizz” for multiplications of 3, “Buzz” for multiplications of 5, and “FizzBuzz” for multiplications of 15. Otherwise, resolves into the given N
* A small “test framework” to test that our types work correctly * Logic constructs, such as And and If * Linked lists * …all that, without running our code once — TypeScript’s language server does it for us.

Blog

Best JavaScript meetup videos from January, 2021

After our latest JavaScript meetup video selection from 2020’s finest, we’ve brought a new collectio...

Read more >>

Best Angular meetup videos from January, 2021

After publishing our Top 10 Angular videos from 2020, we’re finally back with January’s finest. Rang...

Read more >>

Top 10 TypeScript meetup videos in 2020

Ever found yourself wondering what happened in the TypeScript scene in 2020? Well, look no further, ...

Read more >>