Skip to content

Commit

Permalink
removed interface declaration and added the updated type declaration …
Browse files Browse the repository at this point in the history
…to the config.stub
  • Loading branch information
Barabasbalazs committed Dec 20, 2024
1 parent 5e32676 commit ae1bda6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
11 changes: 1 addition & 10 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ export type InferSharedProps<T extends ConfigProvider<ResolvedConfig>> = Returns
Awaited<ReturnType<T['resolver']>>['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
Expand All @@ -214,10 +208,7 @@ export type InferPageProps<
Method extends keyof Controller,
> = Controller[Method] extends (...args: any[]) => any
? Simplify<
Serialize<
InferProps<Extract<Awaited<ReturnType<Controller[Method]>>, PageObject>['props']> &
SharedProps
>
Serialize<InferProps<Extract<Awaited<ReturnType<Controller[Method]>>, PageObject>['props']>>
>
: never

Expand Down
2 changes: 1 addition & 1 deletion stubs/config.stub
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ const inertiaConfig = defineConfig({
export default inertiaConfig

declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {}
export type SharedProps = InferSharedProps<typeof inertiaConfig> & {}
}
6 changes: 3 additions & 3 deletions tests/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ test.group('Frameworks | SSR', (group) => {
export default inertiaConfig
declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {}
export type SharedProps = InferSharedProps<typeof inertiaConfig> & {}
}"
`)
})
Expand Down Expand Up @@ -314,7 +314,7 @@ test.group('Frameworks | SSR', (group) => {
export default inertiaConfig
declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {}
export type SharedProps = InferSharedProps<typeof inertiaConfig> & {}
}"
`)
})
Expand Down Expand Up @@ -367,7 +367,7 @@ test.group('Frameworks | SSR', (group) => {
export default inertiaConfig
declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {}
export type SharedProps = InferSharedProps<typeof inertiaConfig> & {}
}"
`)
})
Expand Down

0 comments on commit ae1bda6

Please sign in to comment.