Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

optional parameter in typescript

/*
**DESCRIPTION**
Default-initialized parameters that come after all required 
parameters are treated as optional, and just like 
optional parameters, can be omitted when calling their 
respective function
*/

export class Test {
    constructor(private foo: string = "foo", private bar: string = "bar") {}
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #optional #parameter #typescript
ADD COMMENT
Topic
Name
9+5 =