Specifying onClick event type with Typescript and React.Konva

后端 未结 5 634
借酒劲吻你
借酒劲吻你 2021-02-04 23:02

I\'m trying to get rid of my tslint error Type declaration of \'any\' loses type-safety. but I\'m struggling to figure out what the correct type would be for the Ev

5条回答
  •  迷失自我
    2021-02-04 23:50

    React.MouseEvent works for me:

    private onClick = (e: React.MouseEvent) => {
      let button = e.target as HTMLInputElement;
    }
    

提交回复
热议问题