PathValue returns `never` for bracket notation array paths like `items[0].name`

Author: zalmentCreated Jan 19, 2026Updated Jan 19, 2026

What happened?

When using defineField or any typed path API with bracket notation for array access (e.g., items[0].name), the PathValue type incorrectly resolves to never instead of the actual type.

The path is correctly accepted as valid (autocomplete works), but the return type is wrong.

Expected:

typescript
const [name] = defineField('items[0].name'); // name should be Ref<string>

Actual:

typescript
const [name] = defineField('items[0].name'); // name is Ref<never>

This happens because PathValue in types/paths.ts doesn't handle the key[index] pattern (e.g., items[0]) - it only handles dot notation (items.0).

Reproduction steps

  1. Create a form with a typed array field:
typescript
interface MyForm {
  items: { name: string }[];
}
const { defineField } = useForm<MyForm>();
  1. Use defineField with bracket notation:
typescript
const [itemName] = defineField('items[0].name');
  1. Hover over itemName - it shows Ref<never> instead of Ref<string>

  2. The same issue occurs with items[0] (should be { name: string }, but returns never)

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

bash

Code of Conduct

Additional context

I've identified the root cause in packages/vee-validate/src/types/paths.ts - the PathValue type doesn't parse the key[index] bracket notation pattern. I have a fix ready and would be happy to submit a PR if this issue is confirmed.