source: trip-planner-front/node_modules/callsites/index.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
Line 
1declare namespace callsites {
2 interface CallSite {
3 /**
4 Returns the value of `this`.
5 */
6 getThis(): unknown | undefined;
7
8 /**
9 Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property.
10 */
11 getTypeName(): string | null;
12
13 /**
14 Returns the current function.
15 */
16 getFunction(): Function | undefined;
17
18 /**
19 Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
20 */
21 getFunctionName(): string | null;
22
23 /**
24 Returns the name of the property of `this` or one of its prototypes that holds the current function.
25 */
26 getMethodName(): string | undefined;
27
28 /**
29 Returns the name of the script if this function was defined in a script.
30 */
31 getFileName(): string | null;
32
33 /**
34 Returns the current line number if this function was defined in a script.
35 */
36 getLineNumber(): number | null;
37
38 /**
39 Returns the current column number if this function was defined in a script.
40 */
41 getColumnNumber(): number | null;
42
43 /**
44 Returns a string representing the location where `eval` was called if this function was created using a call to `eval`.
45 */
46 getEvalOrigin(): string | undefined;
47
48 /**
49 Returns `true` if this is a top-level invocation, that is, if it's a global object.
50 */
51 isToplevel(): boolean;
52
53 /**
54 Returns `true` if this call takes place in code defined by a call to `eval`.
55 */
56 isEval(): boolean;
57
58 /**
59 Returns `true` if this call is in native V8 code.
60 */
61 isNative(): boolean;
62
63 /**
64 Returns `true` if this is a constructor call.
65 */
66 isConstructor(): boolean;
67 }
68}
69
70declare const callsites: {
71 /**
72 Get callsites from the V8 stack trace API.
73
74 @returns An array of `CallSite` objects.
75
76 @example
77 ```
78 import callsites = require('callsites');
79
80 function unicorn() {
81 console.log(callsites()[0].getFileName());
82 //=> '/Users/sindresorhus/dev/callsites/test.js'
83 }
84
85 unicorn();
86 ```
87 */
88 (): callsites.CallSite[];
89
90 // TODO: Remove this for the next major release, refactor the whole definition to:
91 // declare function callsites(): callsites.CallSite[];
92 // export = callsites;
93 default: typeof callsites;
94};
95
96export = callsites;
Note: See TracBrowser for help on using the repository browser.