Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler-sfc): fix type inference issue with the keyof operator #10921

Merged
merged 10 commits into from
Jun 7, 2024

Conversation

jh-leong
Copy link
Member

@jh-leong jh-leong commented May 13, 2024

Fix type inference issue with the keyof operator in defineProps:

  1. Now handles keyof with interface index signature correctly.
  2. Properly handles keyof with Record, Partial, Required, Readonly, Pick, Extract.
  3. If unable to infer keyof operator, now defaults to UNKNOWN instead of String or Object. Fixes using symbol as a prop type throw error #10920, fixes Runtime warnings on type of Prop when using keyof and extends since 3.24 #11002.

Copy link

github-actions bot commented May 13, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.8 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB 53.7 kB 48 kB

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.6 kB 24.9 kB 22.6 kB

@jh-leong jh-leong changed the title fix(compiler-sfc): handle keyof operator usage w/ Record utility type [WIP] fix(compiler-sfc): fix type inference issue with the keyof operator May 13, 2024
@jh-leong jh-leong changed the title [WIP] fix(compiler-sfc): fix type inference issue with the keyof operator fix(compiler-sfc): fix type inference issue with the keyof operator May 13, 2024
@haoqunjiang haoqunjiang added scope: types 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels May 15, 2024
@yyx990803 yyx990803 merged commit 293cf4e into vuejs:main Jun 7, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: types
Projects
None yet
3 participants