網站搜尋

typescript - 如何獲取 HTML data-* 屬性的類型安全


如何為 HTML 的 data-* 屬性獲取類型安全

    interface DivProps {
        id?:string 
        class?:string
        // allow data-*  ? 
    }

    function div(props:DivProps) {

    }
const d = div({"data-id":"1"})