Skip to content

Commit fed562b

Browse files
Avoid depending on @types/node
1 parent 07c7e75 commit fed562b

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/globals.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/// <reference lib="dom" />
22

3+
declare global {
4+
// From @types/node
5+
// eslint-disable-next-line no-var
6+
var global: typeof globalThis;
7+
}
8+
39
function getGlobals(): typeof globalThis | undefined {
410
if (typeof globalThis !== 'undefined') {
511
return globalThis;

src/stub/dom-exception.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
/// <reference types="node" />
21
import { globals } from '../globals';
32
import { setFunctionName } from '../lib/helpers/miscellaneous';
43

4+
declare global {
5+
interface ErrorConstructor {
6+
// From @types/node
7+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
8+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
9+
}
10+
}
11+
512
interface DOMException extends Error {
613
name: string;
714
message: string;

0 commit comments

Comments
 (0)