-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
APIRelates to the public API for TypeScriptRelates to the public API for TypeScript
Description
Search Terms
isNamedTupleMember
Suggestion
TypeScript's Compiler APIs include is
functions for all kinds of Nodes. For example, isClassDeclaration
, isBigIntLiteral
, and so on.
In TypeScript 4.0.1-rc1, a new kind of node is introduced: NamedTupleMember
, but no isNamedTupleMember
predicate function is exposed. For consistency with other kinds of Nodes, TypeScript should arguably also expose such a predicate function.
Use Cases
- Custom Transformers (visiting and transforming Nodes in an AST)
- Working with the Compiler APIs
- etc
Examples
function visitNode (node: TS.Node, context: TS.TransformationContext, typescript: typeof TS): TS.VisitResult<TS.Node> {
if (typescript.isNamedTupleMember(node) {
return visitNamedTupleMember(node, context, typescript);
}
else if (...) {
....
}
}
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
emil14
Metadata
Metadata
Assignees
Labels
APIRelates to the public API for TypeScriptRelates to the public API for TypeScript