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
This commit is contained in:
peaklabs-dev 2026-03-10 23:16:23 +01:00
parent fa149a9da3
commit 5ed3b2e498
No known key found for this signature in database
2 changed files with 13 additions and 11 deletions

View file

@ -1,11 +0,0 @@
declare module "@inertiajs/core" {
export interface InertiaConfig {
sharedPageProps: {
appName: string
}
// flashDataType: {
// toast?: { type: "success" | "error"; message: string };
// };
errorValueType: string[];
}
}

13
resources/js/inertia.d.ts vendored Normal file
View file

@ -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[];
}
}