Closed Shaddix closed 2 years ago
My use case:
const MyParam = createEnumParamTyped<'one' | 'two'>([
'one',
'two',
]);
const [param, setParam] = useQueryParam('paramName', MyParam);
Here param
is properly typed ('one' | 'two' | ...
), but setParam
isn't (I can pass any string to it)
Fixed in #198
Here's the definition of
createEnumParam
:Is there any reason why return type of it isn't
QueryParamConfig<T | null | undefined, T | null | undefined>
(the first generic changed fromstring | null | undefined
toT | null | undefined
?For me the latter seems more correct, as it allows strong-typing of
setParam
function .