In typescript, what is right?
[string] vs string []
public searchOption: [string] = ['date']; public searchOption: string[] = ['date'];
The first is tuple , and the second is an array of strings.
You can do this with tuples:
let searchOption: [string, number] = ['date', 22];
If all you are going to do is make an array of strings, they both seem to behave the same. However, the second is the one you should use.
First, so you can make Tuples like this.
let searchOption: [string, number] = ['date', 1];
. , https://www.typescriptlang.org/docs/handbook/basic-types.html
Source: https://habr.com/ru/post/1016311/More articles:Complicating Apple Watch - swiftSave Password for this website dialog with ChromeDriver, although many command line options try to suppress pop-ups like this - seleniumWhat does backoffMultiplier mean in DefaultRetryPolicy? - androidError: Adjacent JSX elements must be wrapped in a tag - javascriptIIS Cache Repeats - httpAtom Editor 1.15.0 with Go-Plus has a red background in the function source code - goAPI поиска iTunes возвращает старые данные в моем APP - iosGoogle Cloud Variable Environment Variables - google-cloud-datastoreIs there any way to avoid using the ternary operator? - c #this.context.router.push does not work - reactjsAll Articles