#64483·TypeScript

`getChildren()` includes synthetic NodeObjects, that can't easily be discerned from RemoteNodes

Author: QjuhCreated Sep 27, 2026Updated Sep 28, 2026

Search Terms

synthetic, NodeObject, RemoteNode, getChildren()

Version & Regression Information

  • This changed between versions 6 and 7.1

⏯ Playground Link

No response

Code

index.d.ts

typescript
export declare class Client  {
    constructor(options?: Record<string, unknown>);
}
typescript
import {API} from 'typescript/unstable/sync';
import type {Declaration} from 'typescript/unstable/ast';
const program = new API().createProgram('./index.d.ts', {});
const checker = program.getProject().checker;
const getSymbol = (child: Declaration) => [checker.getSymbolAtLocation(child), child.getChildren().map(getSymbol)];
console.log(getSymbol(program.getSourcefile('./index.d.ts'));

Actual behavior

Error: getNodeId requires a RemoteNode when facing the synthetic node for the constructor keyword:

typescript
NodeObject {
  kind: 136,
  flags: 0,
  pos: 2216,
  end: 2232,
  parent: [RemoteNode],
  _data: undefined
}

Expected behavior

getChildren() only returns nodes that can either be used like any other RemoteNode or at least have a flag or isRemoteNode() typeguard to handle accordingly.

Additional information about the issue

Started as discussion in https://discord.com/channels/508357248330760243/640177429775777792/1553810176790765731