types: `true-value`/`false-value` on <input> and `xmlns:xlink`/`xlink:href` on <svg> rejected as unknown attributes in templates
Versions
vue3.5.44 (@vue/runtime-domJSX types)vue-tsc3.3.13 +typescript6.0.3 withstrictTemplates: true; same with@vue/content-mapper4.0.0-alpha.3 +typescript7.1.0-beta, where unknown attributes are always checked
Reproduction
<script setup lang="ts">
import { ref } from 'vue'
const checked = ref<'yes' | 'no'>('no')
</script>
<template>
<input v-model="checked" type="checkbox" true-value="yes" false-value="no" />
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 10 10">
<use xlink:href="#a" />
</svg>
</template>
Actual
error TS2353: Object literal may only specify known properties, and ''true-value'' does not exist in type 'InputHTMLAttributes & ReservedProps'.
error TS2353: Object literal may only specify known properties, and ''xmlns:xlink'' does not exist in type 'SVGAttributes & ReservedProps'.
error TS2353: Object literal may only specify known properties, and ''xlink:href'' does not exist in type 'SVGAttributes & ReservedProps'.
Expected
No errors:
true-value/false-valueare Vue's own checkboxv-modelattributes (vModelCheckboxreads them), soInputHTMLAttributescould declare them (typedany, likevalue).xmlns:xlinkandxlink:hrefare valid SVG attributes.SVGAttributesdeclares them only in camelCase (xmlnsXlink,xlinkHref), but a template writes the namespaced spelling, and a name with:is not camelized, so it never matches.
#9299 reported the xmlns:xlink case and is closed as completed (presumably via xmlnsXlink), but the template spelling is still rejected in 3.5.44. Declaring the namespaced keys too ('xmlns:xlink'?, 'xlink:href'?...) would cover it; if the template-side mapping should handle this instead, feel free to move it to language-tools.
This matters more now that the content mapper (language-tools v4) always reports unknown attributes; with vue-tsc 3 only strictTemplates/checkUnknownProps users saw it.
Traced it to packages/runtime-dom/src/jsx.ts. InputHTMLAttributes has no true-value/false-value even though vModel reads them at runtime for checkboxes, and SVGAttributes only has the camelCase xlinkHref/xmlnsXlink while templates write the namespaced spelling, which never gets camelized.
Opened #16247 with the fix plus dts tests. Checked with tsc, the repro errors before and passes after.