You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
es2026 lib makes JSON.parsereviver parameter required for Parameters, .call and .apply #65007
Plain JSON.parse(text) still compiles because call resolution falls back to the ES5 overload.
But anything that infers from the function type gets the es2026 signature, with reviver required:
Parameters<typeof JSON.parse>
.call and .apply under strictBindCallApply
So code that compiles today with target: es2025 stops compiling with target: es2026 / esnext.
Expected: reviver stays optional in the new overload:
With that one-character change, all the cases below compile.
It also lets the new context argument be used with an optional reviver.
Right now JSON.parse(text, cond ? (k, v, ctx) => ctx.source : undefined) matches neither overload.
Tested with typescript@7.1.0-beta and typescript@7.1.0-dev.20261029.1 (--strict --target es2026). --target es2025 gives no errors.
7.0.2 doesn't ship the es2026 libs, but adding lib.es2026.json.d.ts to files reproduces it there too.
Disclaimer: This issue description and reproducer were entirely generated and tested using Claude Opus 5.5. While the issue was encountered manually by me, it was in a larger codebase not suitable for a simple reproducer.
Sample Code
// tsc --strict --target es2026declareconsttext: string;JSON.parse(text);// OKJSON.parse.call(JSON,text);// error TS2554: Expected 3 arguments, but got 2.JSON.parse.apply(JSON,[text]);// error TS2345: Argument of type '[string]' is not assignable to parameter of type '[text: string, reviver: ...]'.typeP=Parameters<typeofJSON.parse>;// ^? [text: string, reviver: (this: any, key: string, value: any, context: { source?: string | undefined; }) => any]functionparse(...args: P){returnJSON.parse(...args);}parse(text);// error TS2554: Expected 2 arguments, but got 1.functionparseWith(input: string,reviver?: P[1]){returnJSON.parse(input,reviver);// error TS2769: No overload matches this call.}
Activity