TypeScript Interview Questions 2024 (Junior & Mid)
Vložit
- čas přidán 28. 06. 2024
- ------------------------------------------------------------------------------------------
👇🏼 HOW WE CAN HELP YOU
🤔 Find Your Technical Gaps With This FREE 10-Minute Technical Assessment
learn.theseniordev.com/techni...
🚀 Get Rid Of Impostor Syndrome And Fast-track To Senior Level
learn.theseniordev.com/free-tr...
------------------------------------------------------------------------------------------
🔍 Find your technical gaps with this Free Technical Assessment: www.theseniordev.com/free-technical-assessment
I would add to `as const` that it narrows the type as much as possible:
const obj0: { a: number, b: string } = { a: 1, b: 's1' };
const obj1: { readonly a: 1, readonly b: 's1' } = { a: 1, b: 's1' };
Hey man! Do you need any help with editing and Thumbnail?
these are senior questions but the title is clickbait saying junior????
From our experience those questions are mostly midlevel / junior - we will make a Senior TypeScript video soon. This is due to the increase competition in the market in the last years, where a lot of midlevel position are requiring what a senior position used to.
you can extend a type in typescript -_-
It's a new feature
The answer to the first question, and the example given, are pretty bad.
It explains neither what generics are nor why they're useful.
A better answer would be something like:
Generic functions are functions that are meant to have logic that should work with *literally every type*.
However, you don't want to use `any`, *because any loses type information*.
So instead of `any`, you pass *types as parameters* (ie. parametric polymorphism, not ad-hoc polymorphism) so the compiler doesn't lose type information.
Example: The identity function. Clearly, it should work with all types, since it does nothing but return the argument. Ie.: `id(x) == x` for all types. Using `any` would lose type information, therefore it's better to define it as `function id(x: T): T { return x }` which allows the compiler to preserve the type information.
that's quite on spot Zander, yes Bogdan kind of "flyed" through the answer as we had to fit all those question in one video, in a second series we aim to go much deeper, thank you so much for the feedback
Why I hate typescript. Leave javascript alone and stop trying to make it a typed language when it is not. If you are a skilled JS developer you don't need this crap, because it will still not catch runtime errors and just bloats the code. Just learn about guards and typeof and you can make your code runtime safe. JUST STOP TRYING TO MAKE JAVASCRIPT LIKE JAVA!!! And the proper name is ecmascipt.which was written in 13 days, named livescript by Branded Eich in tthe late '90s. As an aside Typescript is an MS tool, and I hate just about anything to do with MS
You don't have to use it! Keep on chugging with Vanilla JS if you're so upset. Good Lord.
Stop crying, no one asked you to use TS