Error
A JavaScript error object or any JVM Throwable. new Error(message) constructs the shared runtime error class.
Valuesstandard library
Type mapping
| TypeScript | JVM | Notes |
|---|---|---|
new Error(message) | typescriptnative.Error | Constructed by TypeScript, thrown to Java as a RuntimeException. |
Error | java.lang.Throwable | Every Throwable is an Error in TypeScript. |
Error interface
interface ErrorA JavaScript error object or any JVM Throwable. new Error(message) constructs the shared runtime typescriptnative.Error. TypeScript catches it as unknown until narrowed.
Properties
message: stringnamereadonly
readonly name: stringError for a typed Error, the JavaScript name for an npm error, RangeError for a StackOverflowError or OutOfMemoryError, and the Java class name for other JVM exceptions.
Methods
toString(): stringname, then : message when both are not empty, as in string concatenation. Java callers keep Throwable.toString().
ErrorConstructor interface
interface ErrorConstructorConstructors
new (message?: string): ErrorGenerated when the website builds, from lib.tsn.d.ts.