Property 'value' does not exist on type EventTarget in TypeScript

后端 未结 8 1052
野趣味
野趣味 2020-11-29 17:06

So the following code is in Angular 4 and I can\'t figure out why it doesn\'t work the way as expected.

Here is a snippet of my handler:

onUpdatingSe         


        
8条回答
  •  离开以前
    2020-11-29 17:40

    add any type to event

    event: any
    

    example

    [element].addEvenListener('mousemove', (event: any) =>{
    //CODE//
    } )
    

    what happens is that typescript adds event as Event type and for some reason it doesn't recognize some properties. Adding it of type any no longer exists this problem, this works for any document.[Property]

提交回复
热议问题