TypeScript Interview Questions 2024 (Junior & Mid)

preview_player
Показать описание
------------------------------------------------------------------------------------------

👇🏼 HOW WE CAN HELP YOU

🤔 Find Your Technical Gaps With This FREE 10-Minute Technical Assessment

🚀 Get Rid Of Impostor Syndrome And Fast-track To Senior Level

------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

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' };

Greemjou
Автор

Great content guys, thanks for the work you are doing it is helping a lot of us to develop more. Keep it up <3

georgechlaidze
Автор

In my opinion, it is the stupidest part of TS. Using types in a "freedom" manner and being happy about that, only adds enormous unnecessary extra work with typings, without any benefits to JS dev. The whole idea of typed JavaScript is broken down by this phrase at once!

RK-gmpd
Автор

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<T>(x: T): T { return x }` which allows the compiler to preserve the type information.

zandernoriega
Автор

you can extend a type in typescript -_-

elie
Автор

Hey man! Do you need any help with editing and Thumbnail?

shunaamtaran
Автор

these are senior questions but the title is clickbait saying junior????

JustinBishop-oc
Автор

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

andrewwall