Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/lib/is-dev.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
declare global {
// Declaration merging requires an interface here, not a type alias.
/* eslint-disable @typescript-eslint/consistent-type-definitions */
interface ImportMetaEnv {
type ImportMetaWithEnv = {
readonly env?: {
readonly DEV?: boolean;
}

interface ImportMeta {
readonly env?: ImportMetaEnv;
}
/* eslint-enable @typescript-eslint/consistent-type-definitions */
}
};
};

/**
* Whether we're running in a dev environment. `true` only when a bundler's
Expand All @@ -19,5 +12,5 @@ declare global {
* by bundlers.
*/
export const isDev: boolean =
import.meta.env?.DEV === true ||
(import.meta as ImportMetaWithEnv).env?.DEV === true ||
(typeof process !== "undefined" && process.env["NODE_ENV"] === "development");
Loading