1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-12 02:27:46 -05:00
denoland-deno/js/types.ts

125 lines
4.5 KiB
TypeScript
Raw Normal View History

2018-08-07 16:27:31 -04:00
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
export type TypedArray = Uint8Array | Float32Array | Int32Array;
// tslint:disable:max-line-length
2018-08-07 16:27:31 -04:00
// Following definitions adapted from:
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/index.d.ts
// Type definitions for Node.js 10.3.x
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
// Parambir Singh <https://github.com/parambirs>
// Christian Vaagland Tellnes <https://github.com/tellnes>
// Wilco Bakker <https://github.com/WilcoBakker>
// Nicolas Voigt <https://github.com/octo-sniffle>
// Chigozirim C. <https://github.com/smac89>
// Flarna <https://github.com/Flarna>
// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
// wwwy3y3 <https://github.com/wwwy3y3>
// Deividas Bakanas <https://github.com/DeividasBakanas>
// Kelvin Jin <https://github.com/kjin>
// Alvis HT Tang <https://github.com/alvis>
// Sebastian Silbermann <https://github.com/eps1lon>
// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
// Alberto Schiabel <https://github.com/jkomyno>
// Klaus Meinhardt <https://github.com/ajafff>
// Huw <https://github.com/hoo29>
// Nicolas Even <https://github.com/n-e>
// Bruno Scheufler <https://github.com/brunoscheufler>
// Mohsen Azimi <https://github.com/mohsen1>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// tslint:enable:max-line-length
2018-08-07 16:27:31 -04:00
export interface CallSite {
2018-10-14 16:29:50 -04:00
/** Value of `this` */
// tslint:disable-next-line:no-any
2018-08-07 16:27:31 -04:00
getThis(): any;
2018-10-14 16:29:50 -04:00
/** Type of `this` as a string.
*
2018-08-07 16:27:31 -04:00
* This is the name of the function stored in the constructor field of
2018-10-14 16:29:50 -04:00
* `this`, if available. Otherwise the object's `[[Class]]` internal
2018-08-07 16:27:31 -04:00
* property.
*/
getTypeName(): string | null;
2018-10-14 16:29:50 -04:00
/** Current function. */
2018-08-07 16:27:31 -04:00
getFunction(): Function | undefined;
2018-10-14 16:29:50 -04:00
/** Name of the current function, typically its name property.
*
2018-08-07 16:27:31 -04:00
* If a name property is not available an attempt will be made to try
* to infer a name from the function's context.
*/
getFunctionName(): string | null;
2018-10-14 16:29:50 -04:00
/** Name of the property (of `this` or one of its prototypes) that holds
* the current function.
2018-08-07 16:27:31 -04:00
*/
getMethodName(): string | null;
2018-10-14 16:29:50 -04:00
/** Name of the script (if this function was defined in a script). */
2018-08-07 16:27:31 -04:00
getFileName(): string | null;
2018-10-14 16:29:50 -04:00
/** Get the script name or source URL for the source map. */
2018-08-07 16:27:31 -04:00
getScriptNameOrSourceURL(): string;
2018-10-14 16:29:50 -04:00
/** Current line number (if this function was defined in a script). */
2018-08-07 16:27:31 -04:00
getLineNumber(): number | null;
2018-10-14 16:29:50 -04:00
/** Current column number (if this function was defined in a script). */
2018-08-07 16:27:31 -04:00
getColumnNumber(): number | null;
2018-10-14 16:29:50 -04:00
/** A call site object representing the location where eval was called (if
* this function was created using a call to `eval`)
2018-08-07 16:27:31 -04:00
*/
getEvalOrigin(): string | undefined;
2018-10-14 16:29:50 -04:00
/** Is this a top level invocation, that is, is `this` the global object? */
2018-08-07 16:27:31 -04:00
isToplevel(): boolean;
2018-10-14 16:29:50 -04:00
/** Does this call take place in code defined by a call to `eval`? */
2018-08-07 16:27:31 -04:00
isEval(): boolean;
2018-10-14 16:29:50 -04:00
/** Is this call in native V8 code? */
2018-08-07 16:27:31 -04:00
isNative(): boolean;
2018-10-14 16:29:50 -04:00
/** Is this a constructor call? */
2018-08-07 16:27:31 -04:00
isConstructor(): boolean;
}
2018-08-06 18:37:32 -04:00
export interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
}
export interface RawSourceMap extends StartOfSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
2018-08-07 16:27:31 -04:00
declare global {
// Declare "static" methods in Error
interface ErrorConstructor {
2018-10-14 16:29:50 -04:00
/** Create `.stack` property on a target object */
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2018-08-07 16:27:31 -04:00
// tslint:disable:max-line-length
2018-08-07 16:27:31 -04:00
/**
* Optional override for formatting stack traces
*
* @see https://github.com/v8/v8/wiki/Stack%20Trace%20API#customizing-stack-traces
*/
// tslint:enable:max-line-length
// tslint:disable-next-line:no-any
2018-08-07 16:27:31 -04:00
prepareStackTrace?: (err: Error, stackTraces: CallSite[]) => any;
stackTraceLimit: number;
}
}