-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.d.ts
58 lines (46 loc) · 1.19 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {CallSite} from 'callsites';
export interface Options {
/**
The callsite depth, meaning how many levels we follow back on the stack trace.
@default 0
@example
```
// foo.ts
import callerCallsite from 'caller-callsite';
export default function foo() {
console.log(callerCallsite().getFileName());
//=> '/Users/sindresorhus/dev/unicorn/foobar.ts'
console.log(callerCallsite({depth: 1}).getFileName());
//=> '/Users/sindresorhus/dev/unicorn/bar.ts'
console.log(callerCallsite({depth: 2}).getFileName());
//=> '/Users/sindresorhus/dev/unicorn/foo.ts'
}
// bar.ts
import foo from './foo.js';
export default function bar() {
foo();
}
// foobar.ts
import bar from './bar.js';
bar();
```
*/
readonly depth?: number;
}
/**
Get the [callsite](https://github.com/sindresorhus/callsites#api) of the caller function.
@example
```js
// foo.ts
import callerCallsite from 'caller-callsite';
export default function foo() {
console.log(callerCallsite().getFileName());
//=> '/Users/sindresorhus/dev/unicorn/bar.ts'
}
// bar.ts
import foo from './foo.js';
foo();
```
*/
export default function callerCallsite(options?: Options): CallSite | undefined;
export {CallSite} from 'callsites';