Files
oxc-project__oxc/tasks/coverage/misc/pass/arguments-eval.d.ts
camc314 47ddedf011 fix(semantic): allow arguments in ambient declarations (#24758)
## Summary

- allow `eval` and `arguments` as direct bindings in ambient declarations
- continue reporting strict-mode errors for destructured ambient bindings
- add focused coverage for declared functions, classes, object patterns, and array patterns

## Why

The semantic checker previously identified allowed bindings by walking to a `TSDeclareFunction`. That missed other ambient declarations, including declared class constructors and methods, and produced diagnostics for TypeScript cases that require no runtime code generation.

The check now uses the existing ambient-context state and rejects only destructuring binding shapes.
2026-07-21 12:43:21 +00:00

34 lines
768 B
TypeScript

type K = (arguments: any[]) => void;
type K2 = (...arguments: any[]) => void;
interface Foo {
bar(arguments: any[]): void;
bar2(...arguments: any[]): void;
}
declare function arguments(): void;
declare function eval(): void;
declare function f(eval: number, arguments: number): number;
declare function f2(...eval: number[]): number;
declare function f3(...arguments: number[]): number;
declare class C {
constructor(arguments: number);
method(eval: number, ...arguments: number[]): void;
}
declare namespace foo {
type arguments = {};
type eval = {};
}
declare namespace foo2 {
interface arguments {}
interface eval {}
}
declare global {
function arguments(...arguments: any[]): typeof arguments;
function eval(...eval: any[]): typeof eval;
}