How to avoid typescript error: Property 'innerHTML' does not exist on type 'Element'

后端 未结 6 1992
时光说笑
时光说笑 2020-12-16 09:14

I\'m trying to place some HTML inside a specific div. When I try this in typescript I get this error: Property \'innerHTML\' does not exist on type \'Element\'

6条回答
  •  暖寄归人
    2020-12-16 09:39

    In future versions of TypeScript, it should not be necessary to do the casting. I've sent a pull request to fix the issue:

    • error: Property 'innnerHTML' does not exist on type 'Element' (https://github.com/Microsoft/TypeScript/issues/5754)
    • https://github.com/Microsoft/TSJS-lib-generator/pull/35 (merged already)

提交回复
热议问题