Skip to content

Why createEnumParam doesn't strongly-type the setParam function? #197

@Shaddix

Description

@Shaddix

Here's the definition of createEnumParam:

export const createEnumParam = <T extends string>(
  enumValues: T[]
): QueryParamConfig<string | null | undefined, T | null | undefined>

Is there any reason why return type of it isn't QueryParamConfig<T | null | undefined, T | null | undefined> (the first generic changed from string | null | undefined to T | null | undefined?

For me the latter seems more correct, as it allows strong-typing of setParam function .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions