l
Size: a a a
N
N
class CustomError1 extends Error {
__proto__: Error;
constructor(message?: string) {
// 'Error' breaks prototype chain here
super(message);
// restore prototype chain
const actualProto = new.target.prototype;
// if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); }
this.__proto__ = actualProto;
}
}
class CustomError2 extends Error {
__proto__: Error;
constructor(message?: string) {
// 'Error' breaks prototype chain here
super(message);
// restore prototype chain
const actualProto = new.target.prototype;
// if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); }
this.__proto__ = actualProto;
}
}
try{
throw new CustomError2();
} catch(err) {
console.log(err instanceof CustomError1)
}S
class CustomError1 extends Error {
__proto__: Error;
constructor(message?: string) {
// 'Error' breaks prototype chain here
super(message);
// restore prototype chain
const actualProto = new.target.prototype;
// if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); }
this.__proto__ = actualProto;
}
}
class CustomError2 extends Error {
__proto__: Error;
constructor(message?: string) {
// 'Error' breaks prototype chain here
super(message);
// restore prototype chain
const actualProto = new.target.prototype;
// if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); }
this.__proto__ = actualProto;
}
}
try{
throw new CustomError2();
} catch(err) {
console.log(err instanceof CustomError1)
}G
d.ts файлы для такого кодаG
EW
d.ts )G
EW
G
G
G
EW
EW
G
G
C🐝
G
C🐝