Typescript combined with vue:! What does it mean?

recently, when I was learning to develop vue, with typescript, I saw such a problem in github, but I couldn"t understand it all the time.

  private today!: {
    active: string[] | never[] | number[];
    finishedDate: string[] | never[];
    isReceived: boolean;
  };

  private title?: string;
  private num!: number;
  private isDone!: boolean;
  private isReceived!: boolean;
What does
like : mean, required parameters? But typescript documents do not have such a view ah, do not understand, a variety of search can not be found.

the great gods give guidance

Mar.21,2021

just look at it separately

! , as opposed to ? , is the syntax of typescript, which means mandatory parsing (that is, telling the typescript compiler that I must have a value here). If you call it when you write ? , typescript will prompt that it may be undefined

.

: is the type declaration


http://www.typescriptlang.org.


OK, thank you. It's just that I can't find the official document, so I'm not so sure. I wrote a demo and reported a mistake directly, which pierced my heart

.
Menu