Typescript Tutorial for Beginners in Hindi Part 5: Type Assertion in Typescript in Hindi

preview_player
Показать описание
Welcome all, we will see Type Assertion in Typescript in Hindi. TypeScript Type Assertion
TypeScript allows you to override its inferred and analyzed view of types in any way you want to. This is done by a mechanism called "type assertion". TypeScript's type assertion is purely you telling the compiler that you know about the types better than it does, and that it should not second guess you.
A common use case for type assertion is when you are porting over code from JavaScript to TypeScript.

Type Assertion vs. Casting
The reason why it's not called "type casting" is that casting generally implies some sort of runtime support. However type assertions are purely a compile-time construct and a way for you to provide hints to the compiler on how you want your code to be analyzed.

Guys, Please support my channel by SUBSCRIBE to my channel and share my videos in your Social Network TimeLines.

Don't Forget to Follow me on all Social Network,

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

Thapa Technical is Bramhashtra of any technical topic, I tried many videos to get it covered but finally I got it here, I am grateful to this channel.

madhavjha
Автор

i love your videos ache se explain krte ho aap

nishaphulwani
Автор

It is better to press ctrl+spacebar to display the intellisense as compare to dot.

manishapadole
Автор

bhai value initilize karana ka baad wo string me convert ho jayaga or string ki property use karsakta hai

rishabgarg
Автор

Hello, aap meri help karoge,
Jo aapki pehli html video hai "menu dropdown" vali..
Usme mera dehradun, delhi, etc. Sab aage aa rha hai, niche nhi aa rha..a
India Delhi
Usa Brazil
Aaise aa rha hai..
Kaise theek kru ??

aaryansehgal
Автор

when i compile ts file into js it automatically add this line into my file and console log show error "Object.defineProperty(exports, "__esModule"

muhammadhamzaalirajpoot
Автор

let myNewVar: any;


myNewVar = 100;

console.log((myNewVar as number).toFixed(2));

Output:-


ƒ toString() { [native code] }



Output should be 100.00. Can you please help me with this?


Thanks

pawansinghbisht
Автор

but in last video you said if we dont mention the data type it will automatically be of type "any" but here you havent mention the type but still its showing string type .:(

kalpeshjoshi
Автор

Bhai pdhate bhut bdia ho bs baar baar subscribe subscribe mt bola kro, us se irritation hoti video dekhne mein😅

abhishekdawer
Автор

Bro me raat me vedio dekh rha hu mere ko background music se dar gya, gatiya h vedio

sumitkumargupta