短评 · ·

X 归档 2023-06-22

1 条动态 · 图 1 · 视频 0
By far the strangest TypeScript trick I've ever come across is the Loose Autocomplete trick.

No idea who discovered this, but it's become widely used by OSS wizards.

It's now even used by React's types to type attributes like aria-role.
我迄今见过最奇怪的 TypeScript 技巧,当属 Loose Autocomplete(宽松自动补全)技巧。

不知道是谁发现的,但它已被 OSS 高手们广泛使用。

现在连 React 的类型定义都用它来给 aria-role 这类属性做类型。
@mattpocockuk 的配图 1/1