Skip to content

Commit

Permalink
Merge pull request #2527 from kuzzleio/fix/global-types
Browse files Browse the repository at this point in the history
Fix global type definitions
  • Loading branch information
fmauNeko authored Mar 21, 2024
2 parents 8f029a3 + 3daa10e commit cc30ee7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/kuzzle/kuzzle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,4 +926,5 @@ class Kuzzle extends KuzzleEventEmitter {
}
}

export { Kuzzle };
module.exports = Kuzzle;
21 changes: 12 additions & 9 deletions lib/types/Global.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Backend } from "../core/backend";
import { Kuzzle } from "../kuzzle";

/* eslint-disable @typescript-eslint/no-namespace */
/**
* This file contains global type declarations for Kuzzle.
* We need to use `var` so Typescript extends the globalThis type.
* See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#type-checking-for-globalthis
*/

/* eslint-disable no-var, vars-on-top */

declare global {
namespace NodeJS {
interface Global {
kuzzle: any;
app: Backend;
NODE_ENV: string;
}
}
var app: Backend;
var kuzzle: Kuzzle;
var NODE_ENV: string;
}

global.NODE_ENV = process.env.NODE_ENV;

export {};

/* eslint-enable @typescript-eslint/no-namespace */
/* eslint-enable no-var, vars-on-top*/

0 comments on commit cc30ee7

Please sign in to comment.