Skip to content

TS incompatibility with [email protected] stringify #129

Closed
@effectiveduck

Description

@effectiveduck

Code:

const eq = encodeQueryParams(
    { x: StringParam },
    { x: "true" }
);
const y = stringify(eq);

Error:

Argument of type 'Partial<EncodedValueMap<{ x: QueryParamConfig<string | null | undefined, string | null | undefined>; }>>' is not assignable to parameter of type 'Record<string, string | number | boolean | Stringifiable[] | null | undefined>'.
  Property 'x' is incompatible with index signature.
    Type 'string | (string | null)[] | null | undefined' is not assignable to type 'string | number | boolean | Stringifiable[] | null | undefined'.
      Type '(string | null)[]' is not assignable to type 'string | number | boolean | Stringifiable[] | null | undefined'.
        Type '(string | null)[]' is not assignable to type 'Stringifiable[]'.
          Type 'string | null' is not assignable to type 'Stringifiable'.
            Type 'null' is not assignable to type 'Stringifiable'.

Initially I thought this was an error with how ArrayParams we're handled but it seems to affect every param type I've tried, also not sure if this is an issue related to this library or query-string but this made most sense to me.

[email protected] release

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