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

[0.5.x] Type vue-inertia #88

Merged
merged 4 commits into from
Aug 28, 2024
Merged

Conversation

ncphillips
Copy link
Contributor

@ncphillips ncphillips commented Aug 12, 2024

The useForm composable for Inertia has no types.

This PR adds them.

@ncphillips ncphillips force-pushed the vue-form-types branch 2 times, most recently from 49eeb3d to 156e031 Compare August 12, 2024 15:47
packages/vue/src/index.ts Outdated Show resolved Hide resolved
import { watchEffect } from 'vue'

export { client }

export const useForm = <Data extends Record<string, unknown>>(method: RequestMethod|(() => RequestMethod), url: string|(() => string), inputs: Data, config: ValidationConfig = {}): any => {
type Precognitive<Data extends object> = {
Copy link
Contributor Author

@ncphillips ncphillips Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sold on this name for the type, but it is private.

I did consider joining with a laravel-precognition type but this is probably more resilient since it's not a true union of attributes.

@ncphillips
Copy link
Contributor Author

This is likely technically a duplicate of #77

Didn't notice that before I started working.

@taylorotwell taylorotwell marked this pull request as draft August 12, 2024 22:03
@ncphillips
Copy link
Contributor Author

Just curious, why mark as Draft @taylorotwell?

I vaguely assume y'all have some big changes to be merged around LaraconUS and so this maybe won't be relevant after said change?

@timacdonald
Copy link
Member

@ncphillips, Taylor has marked it as draft so I can review the PR.

I am currently working on the async validate PR and once that is merged I will be coming through and tidying up / reviewing the draft TypeScript PRs.

@ncphillips
Copy link
Contributor Author

Okay sweet! I thought I saw the contributing docs say drafts wouldn't be reviewed so that's good to know. Thanks a lot 🙏

@timacdonald timacdonald self-assigned this Aug 15, 2024
@timacdonald
Copy link
Member

@ncphillips, would you mind taking a quick look at my changes and let me know any concerns or thoughts?

If you are happy, I'll open the PR for Taylor to review.

@timacdonald timacdonald changed the title Add return type for useForm in laravel-precognition-vue-inertia [0.5.x] Type laravel-precognition-vue-inertia Aug 27, 2024
@ncphillips
Copy link
Contributor Author

@timacdonald besides that little suggestion I think this looks good!

Co-authored-by: Nolan <[email protected]>
@timacdonald
Copy link
Member

Thank you, @ncphillips

@timacdonald timacdonald marked this pull request as ready for review August 27, 2024 23:17
@timacdonald timacdonald changed the title [0.5.x] Type laravel-precognition-vue-inertia [0.5.x] Type ...vue-inertia Aug 28, 2024
@timacdonald timacdonald changed the title [0.5.x] Type ...vue-inertia [0.5.x] Type vue-inertia Aug 28, 2024
@taylorotwell taylorotwell merged commit ba0163c into laravel:main Aug 28, 2024
2 checks passed
@ncphillips ncphillips deleted the vue-form-types branch August 28, 2024 23: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.

3 participants