Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrote SharedProps Type declaration so usePage is not throwing errors #50

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stubs/config.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
exports({ to: app.configPath('inertia.ts') })
}}}
import { defineConfig } from '@adonisjs/inertia'
import type { InferSharedProps } from '@adonisjs/inertia/types'
import type { InferSharedProps, PageProps } from '@adonisjs/inertia/types'

const inertiaConfig = defineConfig({
/**
Expand All @@ -29,5 +29,5 @@ const inertiaConfig = defineConfig({
export default inertiaConfig

declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> {}
export interface SharedProps extends InferSharedProps<typeof inertiaConfig>, PageProps {}
}
12 changes: 6 additions & 6 deletions tests/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ test.group('Frameworks | SSR', (group) => {
const inertiaConfig = await fs.contents('config/inertia.ts')
assert.snapshot(inertiaConfig).matchInline(`
"import { defineConfig } from '@adonisjs/inertia'
import type { InferSharedProps } from '@adonisjs/inertia/types'
import type { InferSharedProps, PageProps } from '@adonisjs/inertia/types'

const inertiaConfig = defineConfig({
/**
Expand All @@ -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 interface SharedProps extends InferSharedProps<typeof inertiaConfig>, PageProps {}
}"
`)
})
Expand All @@ -287,7 +287,7 @@ test.group('Frameworks | SSR', (group) => {

assert.snapshot(inertiaConfig).matchInline(`
"import { defineConfig } from '@adonisjs/inertia'
import type { InferSharedProps } from '@adonisjs/inertia/types'
import type { InferSharedProps, PageProps } from '@adonisjs/inertia/types'

const inertiaConfig = defineConfig({
/**
Expand All @@ -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 interface SharedProps extends InferSharedProps<typeof inertiaConfig>, PageProps {}
}"
`)
})
Expand All @@ -340,7 +340,7 @@ test.group('Frameworks | SSR', (group) => {
const inertiaConfig = await fs.contents('config/inertia.ts')
assert.snapshot(inertiaConfig).matchInline(`
"import { defineConfig } from '@adonisjs/inertia'
import type { InferSharedProps } from '@adonisjs/inertia/types'
import type { InferSharedProps, PageProps } from '@adonisjs/inertia/types'

const inertiaConfig = defineConfig({
/**
Expand All @@ -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 interface SharedProps extends InferSharedProps<typeof inertiaConfig>, PageProps {}
}"
`)
})
Expand Down