microsoft / microsoft/TypeScript
RemoteNodeList inherited array methods throw this.view.getUint32 is not a function
@andrewbranch arbeitet bereits daran.
Seit 16.6.2026.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
## Steps to reproduce
Using `@typescript/native-preview@7.0.0-dev.20260616.1` and Node `v24.11.1`:
1. Create a minimal project and install native-preview:
```sh
mkdir tsgo-remote-node-list-filter
cd tsgo-remote-node-list-filter
npm init -y
npm install @typescript/native-preview@7.0.0-dev.20260616.1
```
2. Save this as `repro.mjs`:
```js
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { API } from "@typescript/native-preview/unstable/sync";
const source = `interface A {}
interface B {}
`;
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "tsgo-remote-node-list-filter-"));
fs.writeFileSync(
path.join(directory, "tsconfig.json"),
JSON.stringify(
{
compilerOptions: {
module: "NodeNext",
moduleResolution: "NodeNext",
skipLibCheck: true,
strict: true,
target: "ES2022",
},
files: ["index.ts"],
},
null,
2
)
);
fs.writeFileSync(path.join(directory, "index.ts"), source);
const api = new API({ cwd: directory });
try {
const project = api.updateSnapshot({ openProject: "tsconfig.json" }).getProjects()[0];
const sourceFile = project.program.getSourceFile("index.ts");
console.log(`sourceFile.statements.length = ${sourceFile.statements.length}`);
console.log(sourceFile.statements.filter(() => true).length);
} finally {
api.close();
}
```
3. Run:
```sh
node repro.mjs
```
## Actual behavior
`sourceFile.statements.length` works, but `sourceFile.statements.filter(() => true)` throws:
```
sourceFile.statements.length = 2
Calling sourceFile.statements.filter(() => true)...
TypeError: this.view.getUint32 is not a function
at RemoteNodeList.get data (node_modules/@typescript/native-preview/src/api/node/node.generated.ts:58:26)
at new RemoteNodeList (node_modules/@typescript/native-preview/src/api/node/node.generated.ts:70:28)
at RemoteNodeList.filter ()
at (repro.mjs:35:43)
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:671:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
```
`sourceFile.statements.map(...)`, `sourceFile.statements.flatMap(...)`, and other inherited array methods appear to have the same issue.
## Expected behavior
The native AST declarations expose `NodeArray` as extending `ReadonlyArray`, so standard array methods are available at compile time. I would expect those methods to work, or for `NodeArray` not to expose inherited array methods that are unsafe to call.
Workaround: `Array.from(sourceFile.statements).filter(() => true)` works.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.