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

TypeScript error with nested properties in InputMenu valueKey and labelKey #3505

Open
dannote opened this issue Mar 9, 2025 · 0 comments
Open
Labels
bug Something isn't working triage v3 #1289

Comments

@dannote
Copy link

dannote commented Mar 9, 2025

Environment

  • Operating System: Darwin
  • Node Version: v20.9.0
  • Nuxt Version: 3.16.0
  • CLI Version: 3.22.5
  • Nitro Version: 2.11.6
  • Package Manager: pnpm@10.6.1
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.0.0-alpha.10

Reproduction

https://codesandbox.io/p/devbox/bold-cache-pkvmch

Description

The InputMenu component fails to handle nested properties (e.g., 'user.id', 'user.name') in valueKey and labelKey props, resulting in a TypeScript error.

Additional context

Proposed fix:

type NestedPathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`
  ? Key extends keyof T
    ? NestedPathValue<T[Key], Rest>
    : any
  : P extends keyof T
  ? T[P]
  : any;

export type SelectItemKey<T> = T extends Record<string, any>
  ? keyof T | (string & { [K in keyof T]?: NestedPathValue<T, K & string> })
  : string;

Logs

@dannote dannote added bug Something isn't working triage v3 #1289 labels Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage v3 #1289
Projects
None yet
Development

No branches or pull requests

1 participant