MCPcopy Create free account
hub / github.com/babel/babel / castNodeTo

Function castNodeTo

packages/babel-parser/src/parser/node.ts:184–190  ·  view source on GitHub ↗
(
    node: NodeType,
    type: T,
  )

Source from the content-addressed store, hash-verified

182 }
183
184 castNodeTo<T extends NodeType["type"]>(
185 node: NodeType,
186 type: T,
187 ): Extract<NodeType, { type: T }> {
188 node.type = type;
189 return node as Extract<NodeType, { type: T }>;
190 }
191
192 cloneIdentifier<T extends Identifier | Placeholder>(node: T): T {
193 // We don't need to clone `typeAnnotations` and `optional`: because

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected