From 3436c0d8b331b8df0eacdd9cc3932ea4c8fd531e Mon Sep 17 00:00:00 2001 From: Julien Ripouteau Date: Sun, 28 Apr 2024 17:59:05 +0200 Subject: [PATCH] refactor: simplify InferPageProps typing --- package.json | 2 +- src/types.ts | 6 ++++-- tests/types.spec.ts | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 577ed61..00490b9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/types.ts b/src/types.ts index cd0b141..f15d195 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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' @@ -139,7 +139,9 @@ export type InferPageProps< Controller, Method extends keyof Controller, > = Controller[Method] extends (...args: any[]) => any - ? Serialize>, string>['props']>> + ? Simplify< + Serialize>, string>['props']>> + > : never /** diff --git a/tests/types.spec.ts b/tests/types.spec.ts index e8747fe..7bc2866 100644 --- a/tests/types.spec.ts +++ b/tests/types.spec.ts @@ -8,6 +8,7 @@ */ import { test } from '@japa/runner' + import { InferPageProps } from '../src/types.js' import { InertiaFactory } from '../factories/inertia_factory.js'