From 3e6bce0b715118597b9c00ac082bd32a24a09b41 Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Sat, 8 Aug 2026 14:27:58 +0200 Subject: [PATCH] fix(lib): avoid global type augmentation in is-dev for JSR publish JSR rejects packages that use `declare global` to modify global types, which broke the jsr publish step in CI. Replace the global ImportMeta augmentation with a local type and cast, keeping the same behavior. --- src/lib/is-dev.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/lib/is-dev.ts b/src/lib/is-dev.ts index 2427a75..04f1d4e 100644 --- a/src/lib/is-dev.ts +++ b/src/lib/is-dev.ts @@ -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 @@ -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");