From 5ed3b2e498f37032f266377907ccce1963d6ee73 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:16:23 +0100 Subject: [PATCH] fix(types): inertia type declaration and shared props typing - when there is no import or export statement on a .d.ts file ts treats it as a "script" instead of a "module". In a "script", declare module "X" is an ambient module declaration that replaces the module. Adding any import or empty export makes the file a module, which changes declare module "X" to a module augmentation that merges with the real module. See: https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules --- resources/js/global.d.ts | 11 ----------- resources/js/inertia.d.ts | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 resources/js/global.d.ts create mode 100644 resources/js/inertia.d.ts diff --git a/resources/js/global.d.ts b/resources/js/global.d.ts deleted file mode 100644 index a0c22ab20..000000000 --- a/resources/js/global.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare module "@inertiajs/core" { - export interface InertiaConfig { - sharedPageProps: { - appName: string - } - // flashDataType: { - // toast?: { type: "success" | "error"; message: string }; - // }; - errorValueType: string[]; - } -} diff --git a/resources/js/inertia.d.ts b/resources/js/inertia.d.ts new file mode 100644 index 000000000..0c547b3ae --- /dev/null +++ b/resources/js/inertia.d.ts @@ -0,0 +1,13 @@ +import "@inertiajs/core"; + +declare module "@inertiajs/core" { + export interface InertiaConfig { + sharedPageProps: { + appName: string; + }; + // flashDataType: { + // toast?: { type: "success" | "error"; message: string }; + // }; + errorValueType: string[]; + } +}