core icon indicating copy to clipboard operation
core copied to clipboard

fix(types/runtime-dom): correct boolean attributes type definitions

Open inottn opened this issue 10 months ago • 3 comments
trafficstars

In HTML, setting a boolean attribute to the string "false" is invalid. Browsers will treat any string value as true.

This issue was introduced by #3776. Based on the description, it was intended to replace only boolean | 'false' | 'true' with Booleanish, but it actually replaced all boolean types with Booleanish as well.

For reference, here's the relevant React type definitions. You can see that boolean and Booleanish are distinct types.

inottn avatar Jan 18 '25 08:01 inottn

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 38 kB 34.2 kB
vue.global.prod.js 158 kB 57.8 kB 51.4 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.2 kB 16.6 kB
createApp 54.3 kB 21.2 kB 19.3 kB
createSSRApp 58.5 kB 22.9 kB 20.9 kB
defineCustomElement 59.2 kB 22.8 kB 20.7 kB
overall 68.4 kB 26.3 kB 24 kB

github-actions[bot] avatar Jan 18 '25 08:01 github-actions[bot]

Open in Stackblitz

@vue/compiler-core

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

npm i https://pkg.pr.new/@vue/compiler-dom@12736
@vue/compiler-ssr

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

npm i https://pkg.pr.new/@vue/compiler-sfc@12736
@vue/reactivity

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

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

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

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

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

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

npm i https://pkg.pr.new/vue@12736

commit: 7464ddd

pkg-pr-new[bot] avatar Jan 18 '25 08:01 pkg-pr-new[bot]

if "true" and boolean are the correct type, why not have them, instead of replacing it with just boolean, as you said "true" is still valid and the types should reflect that, I do agree past that "false" and string should not be allowed for DX purposes.

pikax avatar May 29 '25 17:05 pikax