Skip to content

chore: turn on lint rule to prefer type over interface#716

Merged
james-elicx merged 2 commits intomainfrom
opencode/silent-lagoon
Mar 29, 2026
Merged

chore: turn on lint rule to prefer type over interface#716
james-elicx merged 2 commits intomainfrom
opencode/silent-lagoon

Conversation

@james-elicx
Copy link
Copy Markdown
Collaborator

No description provided.

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@716

commit: 421f3ea

@github-actions
Copy link
Copy Markdown

Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

UnknownError: "Overloaded"

github run

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

@james-elicx Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

UnknownError: "Overloaded"

github run

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: chore: turn on lint rule to prefer type over interface

The mechanical interfacetype 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.tsImportMeta 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.ts correctly keeps Window, ProcessFeatures, ProcessEnv, IncomingMessage as interfaces with a file-level disable
  • fetch-cache.ts correctly keeps RequestInit as an interface with a line-level disable
  • next-shims.d.ts types inside declare module blocks are fine since they're module-scoped, not global augmentations
  • vite-plugin-commonjs.d.ts types inside declare module are fine for the same reason
  • All extends& intersection conversions are semantically equivalent

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

The review has been posted. Here's a summary of what I found:

PR #716 Review Summary

This PR enables the typescript/consistent-type-definitions lint rule (preferring type over interface) and converts ~95 files across the codebase. The changes are overwhelmingly mechanical and correct.

One bug found: In packages/vinext/src/vite-hmr.d.ts, interface ImportMeta was converted to type ImportMeta. This is a script-context .d.ts file where interface ImportMeta performs global declaration merging with TypeScript's built-in ImportMeta (from lib.es5.d.ts), adding the hot property. As a type alias, it shadows rather than augments the global, breaking import.meta.hot typing throughout the codebase.

Everything else is correct:

  • global.d.ts properly keeps Window, ProcessFeatures, ProcessEnv, IncomingMessage as interfaces (with file-level oxlint-disable)
  • fetch-cache.ts properly keeps RequestInit global augmentation as an interface (with line-level disable)
  • extends& intersection conversions in unified-request-context.ts and app-page-boundary-render.ts are semantically equivalent
  • Types inside declare module blocks in next-shims.d.ts and vite-plugin-commonjs.d.ts are fine since they're module-scoped

I requested changes with an inline comment on the specific line that needs fixing.

github run

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

UnknownError: "Overloaded"

github run

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

UnknownError: "Internal server error"

github run

@james-elicx
Copy link
Copy Markdown
Collaborator Author

/bigbonk review

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in app-page-boundary-render.ts and unified-request-context.ts: Correct — no overlapping property names, no recursive types, no this-dependent methods. Semantically equivalent.
  • declare module blocks in next-shims.d.ts and vite-plugin-commonjs.d.ts: Correct — these are complete ambient module declarations, not augmentations. type works fine.
  • Global augmentations in global.d.ts (file-level disable) and fetch-cache.ts (RequestInit line-level disable): Correctly kept as interface since 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.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 29, 2026

Review posted. The PR is approved — the mechanical interfacetype conversions are correct across all 95 files, the extends& intersection conversions are semantically equivalent, and the oxlint-disable exemptions are correctly placed for all global augmentation interfaces that require declaration merging. The fix commit properly resolves the ImportMeta issue identified in the earlier review.

github run

@james-elicx james-elicx merged commit a83be59 into main Mar 29, 2026
32 checks passed
@james-elicx james-elicx deleted the opencode/silent-lagoon branch March 29, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant