Skip to content

Commit

Permalink
refactor: simplify InferPageProps typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Apr 28, 2024
1 parent f1dad28 commit 3436c0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"dependencies": {
"@poppinss/utils": "^6.7.3",
"@tuyau/utils": "^0.0.1",
"@tuyau/utils": "^0.0.2",
"crc-32": "^1.2.2",
"edge-error": "^4.0.1",
"html-entities": "^2.5.2",
Expand Down
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* file that was distributed with this source code.
*/

import type { Serialize } from '@tuyau/utils/types'
import type { HttpContext } from '@adonisjs/core/http'
import type { Serialize, Simplify } from '@tuyau/utils/types'

import { kLazySymbol } from './inertia.js'
import type { VersionCache } from './version_cache.js'
Expand Down Expand Up @@ -139,7 +139,9 @@ export type InferPageProps<
Controller,
Method extends keyof Controller,
> = Controller[Method] extends (...args: any[]) => any
? Serialize<InferProps<Exclude<Awaited<ReturnType<Controller[Method]>>, string>['props']>>
? Simplify<
Serialize<InferProps<Exclude<Awaited<ReturnType<Controller[Method]>>, string>['props']>>
>
: never

/**
Expand Down
1 change: 1 addition & 0 deletions tests/types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { test } from '@japa/runner'

import { InferPageProps } from '../src/types.js'
import { InertiaFactory } from '../factories/inertia_factory.js'

Expand Down

0 comments on commit 3436c0d

Please sign in to comment.