chore: turn on lint rule to prefer type over interface#716
Conversation
|
/bigbonk review |
commit: |
|
|
UnknownError: "Overloaded" |
|
@james-elicx Bonk workflow failed. Check the logs for details. View workflow run · To retry, trigger Bonk again. |
|
/bigbonk review |
|
UnknownError: "Overloaded" |
|
/bigbonk review |
There was a problem hiding this comment.
Review: chore: turn on lint rule to prefer type over interface
The mechanical interface → type conversion is correct across the vast majority of files. The extends → & intersection conversions in unified-request-context.ts and app-page-boundary-render.ts are properly done. The oxlint-disable annotations for global.d.ts (file-level) and fetch-cache.ts (RequestInit global augmentation) are correctly placed.
One bug found:
vite-hmr.d.ts — ImportMeta must stay as interface
ImportMeta is a global interface defined by TypeScript's lib.es5.d.ts. In this script-context .d.ts file (no import/export statements), writing interface ImportMeta { hot?: ViteHotContext } merges with the existing global ImportMeta, adding the hot property. Converting it to type ImportMeta = { ... } creates a local type alias that shadows rather than augments the global — import.meta.hot loses its type information, and all other standard ImportMeta properties (like url) are no longer accessible.
ViteHotData and ViteHotContext are fine as types — they're local helpers not used for merging. Only ImportMeta needs to remain an interface, with an oxlint-disable-next-line comment.
Everything else looks correct:
global.d.tscorrectly keepsWindow,ProcessFeatures,ProcessEnv,IncomingMessageas interfaces with a file-level disablefetch-cache.tscorrectly keepsRequestInitas an interface with a line-level disablenext-shims.d.tstypes insidedeclare moduleblocks are fine since they're module-scoped, not global augmentationsvite-plugin-commonjs.d.tstypes insidedeclare moduleare fine for the same reason- All
extends→&intersection conversions are semantically equivalent
|
The review has been posted. Here's a summary of what I found: PR #716 Review Summary This PR enables the One bug found: In Everything else is correct:
I requested changes with an inline comment on the specific line that needs fixing. |
|
/bigbonk review |
|
UnknownError: "Overloaded" |
|
/bigbonk review |
|
UnknownError: "Internal server error" |
|
/bigbonk review |
There was a problem hiding this comment.
The fix commit (421f3ea) correctly addresses the ImportMeta declaration merging issue in vite-hmr.d.ts by reverting all three types back to interface with a file-level oxlint-disable.
Reviewed the non-trivial conversions:
extends→&intersections inapp-page-boundary-render.tsandunified-request-context.ts: Correct — no overlapping property names, no recursive types, nothis-dependent methods. Semantically equivalent.declare moduleblocks innext-shims.d.tsandvite-plugin-commonjs.d.ts: Correct — these are complete ambient module declarations, not augmentations.typeworks fine.- Global augmentations in
global.d.ts(file-level disable) andfetch-cache.ts(RequestInitline-level disable): Correctly kept asinterfacesince declaration merging requires it. Disable granularity is appropriate. - Lint rule config in
vite.config.ts:["error", "type"]is correct.
All 95 files check out. The mechanical conversions are correct and the exemptions are precisely where they need to be.
|
Review posted. The PR is approved — the mechanical |
No description provided.