Home > OS >  Typescript syntax for Set of Strings similar to string[]?
Typescript syntax for Set of Strings similar to string[]?

Time:07-08

In Typescript, you can define an Array of Strings as string[] or Array<string>. My team prefers the more succinct string[].

When defining a Set of Strings, is there also a more succinct way similar to string[]? Or, is the only option the more verbose Set<string>?

CodePudding user response:

No shorthand syntax exists for Sets like there are are for Arrays. The only option is Set<MyTypeHere>.

  • Related