@lilian1315/elements-writable-properties-types
v0.1.12
Published
Downloads
475
Readme
@lilian1315/elements-writable-properties-types
Auto-generated TypeScript type definitions for writable DOM element properties, derived from @types/web.
Purpose
Standard HTMLElement interfaces include both read-only and writable properties. This package extracts only the writable properties for each element type, making it suitable for type-safe attribute assignment in libraries like @lilian1315/create-element.
Installation
pnpm add -D @lilian1315/elements-writable-properties-typesUsage
import type { DOMTypes } from '@lilian1315/elements-writable-properties-types'
// Only writable properties of HTMLInputElement
type InputProps = DOMTypes.HTMLElementTagNameMap['input']
// { value: string; checked: boolean; placeholder: string; ... }The package also exports the generated DOM interface names used by tooling:
import {
elementTagNameMap,
htmlElementTagNameMap,
mathMLElementTagNameMap,
svgElementTagNameMap,
} from '@lilian1315/elements-writable-properties-types/tag-name-map'
elementTagNameMap.div // 'HTMLDivElement'
elementTagNameMap['svg:path'] // 'SVGPathElement'Regenerating
The types are generated from @types/web using the TypeScript 6 compiler API:
vpr --filter @lilian1315/elements-writable-properties-types buildLicense
MIT
