core icon indicating copy to clipboard operation
core copied to clipboard

feat(jsx-runtime): use interface instead of type for ReservedProps

Open zhiyuanzmj opened this issue 1 year ago โ€ข 3 comments

closed #12384

Summary by CodeRabbit

  • Refactor
    • Updated internal type declarations for improved extensibility. No changes to user-facing features or behavior.

zhiyuanzmj avatar Nov 13 '24 13:11 zhiyuanzmj

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 102 kB 38.7 kB 34.8 kB
vue.global.prod.js 160 kB 58.6 kB 52.2 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.8 kB 18.3 kB 16.8 kB
createApp 54.9 kB 21.3 kB 19.5 kB
createSSRApp 59.1 kB 23.1 kB 21 kB
defineCustomElement 60.3 kB 23 kB 21 kB
overall 69.1 kB 26.5 kB 24.2 kB

github-actions[bot] avatar Nov 13 '24 13:11 github-actions[bot]

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@12385
@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@12385
@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@12385
@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@12385
@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@12385
@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@12385
@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@12385
@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@12385
@vue/shared

npm i https://pkg.pr.new/@vue/shared@12385
vue

npm i https://pkg.pr.new/vue@12385
@vue/compat

npm i https://pkg.pr.new/@vue/compat@12385

commit: e00f009

pkg-pr-new[bot] avatar Nov 13 '24 13:11 pkg-pr-new[bot]

[!CAUTION]

Review failed

The pull request is closed.

Walkthrough

The PR converts ReservedProps in packages/runtime-dom/src/jsx.ts from a type alias to an exported interface with the same optional properties (key, ref, ref_for, ref_key), enabling interface merging and module augmentation without changing property types.

Changes

Cohort / File(s) Change Summary
JSX typings
packages/runtime-dom/src/jsx.ts
ReservedProps changed from export type ReservedProps = { ... } to export interface ReservedProps { ... } (same properties preserved).

Sequence Diagram(s)

sequenceDiagram
    participant User as User code (d.ts)
    participant RuntimeJSX as packages/runtime-dom/src/jsx.ts

    User->>RuntimeJSX: declare module augmentation adding fields to ReservedProps
    Note right of RuntimeJSX: ReservedProps is an interface\nso declaration merging applies
    RuntimeJSX-->>User: merged ReservedProps visible to JSX typings

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

  • Review focus: packages/runtime-dom/src/jsx.ts for correct export and no accidental API surface change.
  • Verify downstream consumers/typedefs compile (module augmentation works as intended).

Possibly related PRs

  • vuejs/core#12771 โ€” Modifies the same ReservedProps symbol in packages/runtime-dom/src/jsx.ts (adds | undefined to optional properties); likely related to JSX typings adjustments.

Suggested labels

easy to merge

Suggested reviewers

  • jh-leong

Poem

Iโ€™m a rabbit in code, nibbling types with care,
ReservedProps grew ears and now welcomes your flair.
Hop in with augmentations, merge what you please,
JSX fields flourish among interfaces and trees. ๐Ÿ‡โœจ

โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

๐Ÿ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between e00f0098e4e7364cbc89f9c9942407d4df03011e and f02f79b7c5896596924886c5f755ea48d333e56a.

๐Ÿ“’ Files selected for processing (1)
  • packages/runtime-dom/src/jsx.ts (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jun 02 '25 12:06 coderabbitai[bot]