dukat
dukat copied to clipboard
Extending Error class
Following code:
export class DateTimeParseException extends Error {
constructor(message?: string);
}
export class DateTimeException extends Error {
constructor(message?: string);
}
Error из lib.es5.d.ts
interface ErrorConstructor {
new(message?: string): Error;
(message?: string): Error;
readonly prototype: Error;
}
declare var Error: ErrorConstructor;
is translated to:
external open class DateTimeParseException(message: String = definedExternally) : Error
external open class DateTimeException(message: String = definedExternally) : Error
external interface ErrorConstructor {
@nativeInvoke
operator fun invoke(message: String = definedExternally): Error
var prototype: Error
}
which is actually looks like a regression - Error is not an open class in kotlin so we ban it's extension.