类似于字符串的字符串的打字稿语法[]?

发布于 2025-02-13 23:34:34 字数 326 浏览 0 评论 0 原文

数组< string> 。我的团队更喜欢更简洁的字符串[]

定义一组字符串时,是否还有一种类似于 string [] 的更简洁的方式?还是唯一的选项是更多的详细 set< string>

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>?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情勿念 2025-02-20 23:34:34

set s不存在速记语法,例如 array s。唯一的选项是 set&lt; mytypehere&gt;

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文