You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried restarting VS Code or running Vetur: Restart VLS
Info
Platform: macOS
Vetur version: 0.33.1
VS Code version: 1.55.2
Problem
Conversion of type 'FunctionConstructor' to type 'PropType<OnSelectCallback | null>' may be a mistake because neither type sufficiently overlaps with the other.
This issue only occurs when the PropType annotation contains null. Vetur takes a normal function signature there just fine.
Since other prop types allow being augmented with null, and Vue has supported adding function signatures to props since #9733, I'm fairly certain this syntax should work.
Nullable function props are useful over events in the case where a component should behave differently based on the existence of a callback function. For example, a component may in some contexts be interactive, perhaps indicating in its UI that it is interactive, and calling a callback function passed by its parent component. In other contexts, the same component may only display data, but formatted in the same manner as the interactive version. I don't know a way to have a component check that its parent component handles an event, so function props have been a good way for us to make that check.
Vetur: Restart VLS
Info
Problem
Reproducible Case
https://github.com/AverageHelper/prop-type-function-or-null
"strict": true
in the tsconfig that manages the vue file in question.Function
and default isnull
PropType
that includes your custom callback signature andnull
The text was updated successfully, but these errors were encountered: