ITADN

support isTypeOf on a single NodeType in the string format

#21ClosedLoTwT 创建于 2023-12-05
enhancement
L
LoTwTcommented
### Clear and concise description of the problem Currently, the function `isTypeOf` supports operating on NodeTypes in the `Array` format, although it just includes a single NodeType. It may be better to support `isTypeOf` on a single NodeType in the string format. ### Suggested solution make the new type signature like the following ```diff function isTypeOf<K extends NodeType>( node: t.Node | undefined | null, + types: Readonly<K[]> | K, ): node is GetNode<K> ``` ### Alternative _No response_ ### Additional context _No response_ ### Validations - [X] Follow our [Code of Conduct](https://github.com/sxzz/.github/blob/main/CODE_OF_CONDUCT.md) - [X] Read the [Contributing Guide](https://github.com/sxzz/contribute). - [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
关闭于 2023-12-05 0 条评论