Files
oxc/tasks/coverage/misc/pass/instantiation-in-operator.ts
T
Boshen 3b36543095 fix(parser): preserve in-context after TypeScript type arguments (#28300)
Type arguments followed by `in` must preserve the surrounding grammar
context. Accept the binary operator in expressions while leaving it
available as the separator in `for-in` heads.

AI-assisted implementation.
2026-10-29 16:30:19 +08:00

11 lines
332 B
TypeScript

const factory = null as unknown as string & { <T>(): T };
const object = {};
type Box<T> = { value: T };
const direct = factory<number> in object;
const nested = factory<Box<number>> in object;
if (factory<string> in object) {}
for (; factory<number> in object; ) {}
for (let present = (factory<boolean> in object); present; ) {}