Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error with exactOptionalPropertyTypes on #63

Open
dshook opened this issue Dec 29, 2023 · 0 comments
Open

Type error with exactOptionalPropertyTypes on #63

dshook opened this issue Dec 29, 2023 · 0 comments

Comments

@dshook
Copy link

dshook commented Dec 29, 2023

Describe the bug

Given this code:

const booleanFilters = queryParam('bf', ssp.array<string>([]));

I get this typescript error when exactOptionalPropertyTypes is true in my tsconfig

Argument of type '{ encode: (value: string[]) => string; decode: (value: string | null) => string[] | null; defaultValue: string[] | undefined; }' is not assignable to parameter of type 'EncodeAndDecodeOptions<string[]>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  Types of property 'defaultValue' are incompatible.
    Type 'string[] | undefined' is not assignable to type 'string[]'.
      Type 'undefined' is not assignable to type 'string[]'.ts(2379)

Reproduction

import { ssp, queryParam } from 'sveltekit-search-params';

const booleanFilters = queryParam('bf', ssp.array<string>([]));

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant