Home > front end >  In the typescript modifiers:? ASTModifiers is what meaning, see the typescript technical documents d
In the typescript modifiers:? ASTModifiers is what meaning, see the typescript technical documents d

Time:04-03

Typescript syntax of the figure, the return value of a function type front and what is the meaning of the question mark
? Boolean and? ASTModifiers this grammar don't understand is what meaning, in typescsript technical document no introduce

CodePudding user response:

Typescript is strongly typed, you said these two things is to point to the data type of the variable, ASTModifiers you here refers to the corresponding data types and modifiers; Boolean refers to the function of the return type is Boolean value, in front of them? Number is you designedly to said is your problem??????? ASTElement and ASTModifiers are defined, is likely to be interface or type may

Before we use js, is directly stated variable
Let a=1;
Const b='2';
To the ts, becomes a
Let a: number=1;
Let b: string='2'
Of course, this kind of simple and direct statement and an initial value, even if not stated data type can also be, because you can "inference" come out, but you are a function of parameters, you don't write, internal function is not know

Previously declared a function
The function func () {} can

To the ts
The function func () : it's all possible returns the data type of the {
}

Without return, is void, digital number... Most lazy any; But do not recommend using any lost its meaning;
  • Related