let el:HTMLElement = document.getElementById('test') as HTMLElement;
if(el.value !== ''){
}
报错Property 'value' does not exist on type 'HTMLElement'
解决方案
let el:HTMLElement = document.getElementById('test') as HTMLElement;
if((el as HTMLElement).value !== ''){
}
Property XXX does not exist on type 'HTMLElement' 问题同理解决
网友评论