What does the exclamation mark do in TypeScript

0 votes

When looking at the sourcecode for a tslint rule, I came across the following statement:

if (node.parent!.kind === ts.SyntaxKind.ObjectLiteralExpression) {
    return;
}

Notice the ! operator after node.parent?

What is it and how does it work?

May 31, 2022 in TypeSript by Logan
• 2,140 points
931 views

1 answer to this question.

0 votes
The exclamation mark is called the non-null assertion operator. The type checker sometimes does not work so you can include this explicitly.
answered Jun 1, 2022 by Nina
• 3,060 points

Related Questions In TypeSript

0 votes
1 answer
0 votes
1 answer

What is the question mark for in a Typescript parameter name?

It is to mark the parameter as optional. TypeScript ...READ MORE

answered Aug 3, 2022 in TypeSript by Abhinaya
• 1,160 points
1,005 views
0 votes
1 answer
0 votes
1 answer

What does <T> do in TypeSript?

This is a TS Generics declaration. T will be declared ...READ MORE

answered May 31, 2022 in TypeSript by Nina
• 3,060 points
350 views
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,420 points
1,915 views
0 votes
1 answer

How to use next-seo for setting nextjs meta tag with multiple OGP images?

https://github.com/garmeeh/next-seo use this git repo that contains ...READ MORE

answered Feb 24, 2022 in Others by narikkadan
• 63,420 points
5,057 views
0 votes
0 answers

how to sign bitcoin psbt with ledger?

I'm trying to sign a PSBT transaction ...READ MORE

Mar 9, 2022 in Blockchain by Soham
• 9,700 points
1,274 views
0 votes
1 answer

Can't bind to 'ngModel' since it isn't a known property of 'input'

Just add this in the app.module.ts file: import { FormsModule ...READ MORE

answered Apr 30, 2022 in Other DevOps Questions by narikkadan
• 63,420 points
3,923 views
0 votes
1 answer

What does the @ (at sign) sign do in TypeScript?

The big news this week is the ...READ MORE

answered Jun 10, 2022 in TypeSript by Nina
• 3,060 points
602 views
0 votes
1 answer

Now I know what 'pick' does. But I want to do the opposite and remove values from an object.

You can use the keyword Omit for ...READ MORE

answered May 27, 2022 in TypeSript by Nina
• 3,060 points
285 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP