-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SharedProps returning error when used in usePage hook #46
Comments
@Julien-R44 reaching out making sure you were able to replicate it? |
Yup, can confirm this is a bug. I haven't had time to look into it yet. Happy to accept a PR |
I think that by rewriting the template like this in the declare module '@adonisjs/inertia/types' {
export type SharedProps = InferSharedProps<typeof inertiaConfig> & {
prop2: string
}
} and also removing this interface declaration from the export interface SharedProps {} See: |
Fixed by #50 |
@Julien-R44 I checked the implementation that I did and it seems to work for |
You need to configure InferPageProps correctly : point to a real controller that returns real data. For example, you could create this controller: export class AboutController {
async index({ inertia }: HttpContext) {
return inertia.render('about', { bar: 42 })
}
} If you do this then you will be unable to access |
@Julien-R44 That's what I did. The type checking seems to be working but it looks like the props don't get passed properly to it from the controller. I don't think that this was the PR that broke it. |
Package version
1.2.2
Describe the bug
When augmenting the SharedProps interface like shown in the documentation, an error is raised by the
usePage<SharedProps>()
hook.Passing any value into the module augmentation causes it to break
If prop2: string is removed then the error above goes away
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: