From ae1bda64a3f5496ed37c15f82bd7f8649b9f7bda Mon Sep 17 00:00:00 2001 From: Balazs Barabas Date: Fri, 20 Dec 2024 16:35:05 +0200 Subject: [PATCH] removed interface declaration and added the updated type declaration to the config.stub --- src/types.ts | 11 +---------- stubs/config.stub | 2 +- tests/configure.spec.ts | 6 +++--- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/types.ts b/src/types.ts index ff1da11..54c410e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -184,12 +184,6 @@ export type InferSharedProps> = Returns Awaited>['sharedData'] > -/** - * The shared props inferred from the user config user-land. - * Should be module augmented by the user - */ -export interface SharedProps {} - /** * Helper for infering the page props from a Controller method that returns * inertia.render @@ -214,10 +208,7 @@ export type InferPageProps< Method extends keyof Controller, > = Controller[Method] extends (...args: any[]) => any ? Simplify< - Serialize< - InferProps>, PageObject>['props']> & - SharedProps - > + Serialize>, PageObject>['props']>> > : never diff --git a/stubs/config.stub b/stubs/config.stub index a8d5856..faf16e3 100644 --- a/stubs/config.stub +++ b/stubs/config.stub @@ -29,5 +29,5 @@ const inertiaConfig = defineConfig({ export default inertiaConfig declare module '@adonisjs/inertia/types' { - export interface SharedProps extends InferSharedProps {} + export type SharedProps = InferSharedProps & {} } diff --git a/tests/configure.spec.ts b/tests/configure.spec.ts index 26c44cb..da34814 100644 --- a/tests/configure.spec.ts +++ b/tests/configure.spec.ts @@ -261,7 +261,7 @@ test.group('Frameworks | SSR', (group) => { export default inertiaConfig declare module '@adonisjs/inertia/types' { - export interface SharedProps extends InferSharedProps {} + export type SharedProps = InferSharedProps & {} }" `) }) @@ -314,7 +314,7 @@ test.group('Frameworks | SSR', (group) => { export default inertiaConfig declare module '@adonisjs/inertia/types' { - export interface SharedProps extends InferSharedProps {} + export type SharedProps = InferSharedProps & {} }" `) }) @@ -367,7 +367,7 @@ test.group('Frameworks | SSR', (group) => { export default inertiaConfig declare module '@adonisjs/inertia/types' { - export interface SharedProps extends InferSharedProps {} + export type SharedProps = InferSharedProps & {} }" `) })