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

fix: infer types #79

Merged
merged 3 commits into from
Nov 5, 2024
Merged

fix: infer types #79

merged 3 commits into from
Nov 5, 2024

Conversation

adamcikado
Copy link
Contributor

πŸ”— Linked issue

#78

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #78

πŸ“ Checklist

  • I have linked an issue or discussion.

[K in keyof T]: undefined extends T[K] ? never : K
}[keyof T]

type Id<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this Id helper does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It merges the the type.

Without Id it would create type like this:

{
  name: string
} & {
  age?: number | undefined
}

With Id it merges type to:

{
  name: string
  age?: number | undefined
}

@thetutlage
Copy link
Contributor

Related. adamcikado#1

feat: fix types inference for object groups
@thetutlage thetutlage merged commit 54f5237 into vinejs:develop Nov 5, 2024
6 checks passed
@thetutlage
Copy link
Contributor

Thanks :)

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.

Infer returns incorrect type for object with optional properties
2 participants