According to this post
How to properly initialize en ErrorEvent in javascript?
You must create EventErrorusing this code:
EventError
var error = new ErrorEvent('oh nose', { error : new Error('AAAHHHH'), message : 'A monkey is throwing bananas at me!', lineno : 402, filename : 'closet.html' });
However, if you try this on the TypeScript playground:
https://www.typescriptlang.org/play/#src=var%20error%20%3D%20new%20ErrorEvent ('oh% 20nose'% 2C% 20% 7B% 0A% 20% 20% 20% 20error% 20 % 3A% 20new% 20Error ('AAAHHHH')% 2C% 0A% 20% 20% 20% 20message% 20% 3A% 20'A% 20monkey% 20is% 20throwing% 20bananas% 20at% 20me!% 2C% 0A% 20 % 20% 20% 20lineno% 20% 3A% 20402% 2C% 0A% 20% 20% 20% 20filename% 20% 3A% 20% 0A% 7D 'closet.html')% 3B
It says Supplied parameters do not match any signature of call target.
Supplied parameters do not match any signature of call target.
Even this simple example does not compile:
var error = new ErrorEvent('oh nose');
I tried to figure this out by looking at the type definition
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts#L9612
.
EventError TypeScript?
lib.es6.d.ts .
TypeScript github, lib.es6.d.ts :
// add this interface interface ErrorEventInit { // ...put the properties here... } // edit this declare var new signature declare var ErrorEvent: { new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; prototype: ErrorEvent; }
Source: https://habr.com/ru/post/1662655/More articles:Create a function with a given number of input arguments - functionRails Active Record cancel (save or create) within before_create callback without raising exception - ruby | fooobar.comОбтекание конструкторов шаблонов С++ в классе шаблонов - javaUnity экспортирует проект Android с выпуском SDK в Facebook - androidI used the composer to upgrade to Laravel 5.3, which broke it - exceptionJava Scanner class does not work in tokenization when 1024 characters is a divisor - javaHow to properly initialize ErrorEvent in javascript? - javascriptМетод или Где не существует. Laravel 5.3 - phpWhat is the difference between localhost.log, catalina.log, manager.log, host-manager.log? - tomcatchanging the range / limits of the polar diagram in octave / matlab - matlabAll Articles