Subscribe on changes!

Improve prop default factory typings

avatar
Mar 2nd 2022

Is there a way to improve that typing for the DefaultFactory type? The callback type currently receives Data which is just Record<string, any> when it is actually all the props on the component.

https://github.com/vuejs/core/blob/5898629d723e82b68e9b17b91bf8b1a8390a3912/packages/runtime-core/src/componentProps.ts#L54

These props are already inferred elsewhere, but might not be possible in the current context so I'm just enquiring.

What problem does this feature solve?

You would get typehints of the available props in the default factory.

What does the proposed API look like?