Rebasing Guidelines and Best Practices
mainWhen rebasing changes from the spec repository, adhere to these rules:
- Minimize Runtime Changes: Prefer adapting TypeScript types over changing code behavior. If type-checking is impossible, use
assertExistsoruncheckedAssertNarrowedType. - Parameter Renaming: To avoid TypeScript issues with re-assigning function parameters, rename the parameter with a
Paramsuffix and create a local variable with the original name. - Avoid New Dependencies: Do not add new dependencies to the polyfill.
- File Structure: Keep code organized in the same files as upstream. Do not create arbitrary new files for organization.
- BigInt Handling: Use
JSBIfor bigint compatibility instead of upstream'sbig-integerto ensure correct type-checking and build-time transpilation. - Ecmascript Module Differences: Note that
polyfill/lib/ecmascript.tsuses regular module exports, whereas upstreamecmascript.mjsuses object properties; direct rebasing of these files will fail and requires manual intervention.