ReviewOS

home-lang/home

TypeScript parity: object defaults and Function standard fields

#769
Closed chris opened this 8 days ago ·
8 days ago

Tracks the TypeScript compatibility batch for object-literal parameter defaults and the standard Function instance surface, as part of #66 and #548.

The checker previously rejected valid defaults such as Record<string, unknown> = {} and string | { message?: string } = {} because annotated parameter defaults skipped the existing object-literal structural relation. It also modeled inherited constructor values and the builtin Function interface without length, prototype, or the ES2015 name field.

Implemented in ff2a44c:

  • Route object-literal parameter defaults through the same structural relation used by other object-literal assignment sites, while retaining failures for incompatible nonempty defaults.
  • Add Function.length: number, Function.prototype: any, and ES2015 Core gated Function.name: string to builtin and inherited-constructor Function shapes.
  • Respect explicit lib selection and target tiers; ES5 and ES2015.Collection alone do not expose Function.name.
  • Preserve callable-to-Function destructuring assignment through the checker-level intrinsic Function relation.
  • Add exact modern, ES5, component-lib, invalid-default, Function-cache, allocation-failure, and destructuring coverage.

Validation:

  • Type checker: 4,383/4,383 tests pass in ReleaseFast.
  • Full ReleaseFast build with JSC: 50/50 steps pass.
  • Pinned Zod v4.5.2 core oracle: 39 diagnostics -> 34, removing five expected false positives with zero additions.
  • zig fmt --check, git diff --check, and focused Pickier pass.
8 days ago

Completed on origin/main by ff2a44cc5, authored and committed by Chris Breuer without coauthors.

Final verification: checker 4,383/4,383; ReleaseFast build 50/50; pinned Zod v4.5.2 core 39 -> 34 with exactly five expected removals and zero additions; focused formatting and Pickier clean. Continued parity work remains tracked in #66 and #548.

Sign in to comment on this issue.