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

Improve type checking of request data #1537

Open
wants to merge 2 commits into
base: v1
Choose a base branch
from

Conversation

7nohe
Copy link

@7nohe 7nohe commented Apr 28, 2023

I implemented the feature of #1536.

import { router } from '@inertiajs/vue3'
type RequestData = { message: string }
const onClick = () => {
  router.post<RequestData>(url, { title: 'hello' }, options) // <- TypeScript Error
  router.post<RequestData>(url, { message: 'hello' }, options) // <- OK
}

In this PR, I have added improved type checking for request data.
The code snippet above demonstrates how the new feature works.
When posting data with an incorrect property, such as { title: 'hello' }, it will result in a TypeScript error.

@joetannenbaum joetannenbaum changed the base branch from master to v1 October 9, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant