Skip to content

Created a function that returns a Valibot type but not getting intellisense for types #531

Answered by fabian-hiller
babakfp asked this question in Q&A
Discussion options

You must be logged in to vote

It may work if you use a generic:

export const getPluginBaseSchema = <TEntries extends v.ObjectEntries>(
    options: TEntries
) => {
    return v.optional(
        v.merge(
            [
                v.object(options),
                v.object({
                    // ...
                }),
            ],
            v.never()
        ),
        {}
    )
}

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@babakfp
Comment options

@fabian-hiller
Comment options

@babakfp
Comment options

@fabian-hiller
Comment options

@babakfp
Comment options

Answer selected by babakfp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants