GlobalEventHandlers.onerror should be of type ErrorEventHandler | null #29876
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
Milestone
TypeScript Version: 3.2.1
Search Terms: lib.dom.ts GlobalEventHandlers onerror
Code
Expected behavior:
it should be possible to assign null to onerror
Actual behavior:
type 'null' is not assignable to type 'ErrorEventHandler'
Playground Link:
Playground link
Related Issues:
#28638 (not really related)
I believe line https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L5478 can be modified to allow null as follows:
Option 1:
Option 2
and a type ErrorEventHandler
and leave 'onerror: ErrorEventHandler;' as is.
The text was updated successfully, but these errors were encountered: