mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[stacktrace-js] add getSync definition
This commit is contained in:
Vendored
+9
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for stacktrace.js
|
||||
// Project: https://github.com/stacktracejs/stacktrace.js
|
||||
// Definitions by: Exceptionless <https://github.com/exceptionless>
|
||||
// Chun-Yan Ho <https://github.com/pilagod>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace StackTrace {
|
||||
@@ -34,7 +35,7 @@ declare namespace StackTrace {
|
||||
isNative: boolean;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
export interface RequestOptions {
|
||||
headers: { [id: string]: string };
|
||||
}
|
||||
@@ -46,6 +47,13 @@ declare namespace StackTrace {
|
||||
*/
|
||||
export function get(options?: StackTraceOptions): Promise<StackFrame[]>;
|
||||
|
||||
/**
|
||||
* Get a backtrace from invocation point synchronously.
|
||||
* @param options Options Object
|
||||
* @return Array[StackFrame]
|
||||
*/
|
||||
export function getSync(options?: { filter?: (stackFrame: StackFrame) => boolean }): StackFrame[]
|
||||
|
||||
/**
|
||||
* Given an error object, parse it.
|
||||
* @param error Error object
|
||||
|
||||
@@ -29,6 +29,7 @@ const options: StackTrace.StackTraceOptions = {
|
||||
const error = new Error('BOOM!');
|
||||
|
||||
StackTrace.get(options).then(logger);
|
||||
logger(StackTrace.getSync({ filter: options.filter }))
|
||||
StackTrace.fromError(error, options).then(logger);
|
||||
StackTrace.generateArtificially(options).then(logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user