mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Expand typings for source-map-support.
This commit is contained in:
parent
33bf97ba1e
commit
a8fbeb0d28
@ -3,3 +3,39 @@
|
||||
import sms = require('source-map-support');
|
||||
|
||||
sms.install();
|
||||
|
||||
function retrieveFile(path: string): string {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
function retrieveSourceMap(source: string): sms.UrlAndMap {
|
||||
return {
|
||||
url: "http://foo",
|
||||
map: "foo"
|
||||
};
|
||||
}
|
||||
|
||||
var options: sms.Options = {
|
||||
emptyCacheBetweenOperations: false,
|
||||
handleUncaughtExceptions: false,
|
||||
retrieveFile: retrieveFile,
|
||||
retrieveSourceMap: retrieveSourceMap
|
||||
};
|
||||
|
||||
sms.install(options);
|
||||
|
||||
var stackFrame: any; // TODO: this should be a StackFrame, but it seems this would need to be defined elsewhere (in e.g. lib.d.ts)
|
||||
stackFrame = sms.wrapCallSite(stackFrame);
|
||||
|
||||
var s: string;
|
||||
s = sms.getErrorSource(new Error("foo"));
|
||||
|
||||
var p: sms.Position = {
|
||||
column: 0,
|
||||
line: 0,
|
||||
source: "foo"
|
||||
};
|
||||
p = sms.mapSourcePosition(p);
|
||||
|
||||
var u: sms.UrlAndMap;
|
||||
u = retrieveSourceMap("foo");
|
||||
|
||||
37
source-map-support/source-map-support.d.ts
vendored
37
source-map-support/source-map-support.d.ts
vendored
@ -1,8 +1,41 @@
|
||||
// Type definitions for source-map-support 0.2.5
|
||||
// Type definitions for source-map-support 0.2.6
|
||||
// Project: https://github.com/evanw/source-map-support
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'source-map-support' {
|
||||
export function install(): any;
|
||||
/**
|
||||
* Output of retrieveSourceMap().
|
||||
*/
|
||||
export interface UrlAndMap {
|
||||
url: string;
|
||||
map: any; // string or Buffer
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to install().
|
||||
*/
|
||||
export interface Options {
|
||||
handleUncaughtExceptions?: boolean;
|
||||
emptyCacheBetweenOperations?: boolean;
|
||||
retrieveFile?: (path: string) => string;
|
||||
retrieveSourceMap?: (source: string) => UrlAndMap;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
source: string;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
|
||||
export function getErrorSource(error: Error): string;
|
||||
export function mapSourcePosition(position: Position): Position;
|
||||
export function retrieveSourceMap(source: string): UrlAndMap;
|
||||
|
||||
/**
|
||||
* Install SourceMap support.
|
||||
* @param options Can be used to e.g. disable uncaughtException handler.
|
||||
*/
|
||||
export function install(options?: Options): void;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user