DefinitelyTyped / DefinitelyTyped/DefinitelyTyped

[@types/query-string]

Open
#30,205 6 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
51.4k
Forks
30.4k
Avg merge
3d 21h
Merged PRs (30d)
108

Description

If you know how to fix the issue, make a pull request instead.

  • I tried using the @types/query-string package and had problems.
  • I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • Mention the authors (see Definitions by: in index.d.ts) so they can respond.
    • Authors: @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro

Just a small improvement suggestion.

export interface OutputParams {
  [key: string]: string | string[] | undefined;
}

export function parse<T = OutputParams>(str: string, options?: ParseOptions): T;
export function parseUrl<T = OutputParams>(str: string, options?: ParseOptions): {url: string, query: T};

Usage example:

type MyQuery = {
  foo: string;
  bar: string;
}

const query = qs.parse<MyQuery>(location.search);

And the IDE can suggest the query object's properties.

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @types/query-string index.d.ts definition mentioned in the issue and inspect the current parse and parseUrl declarations. Add the proposed generic query type signatures so callers can provide MyQuery and receive typed properties; confirm the declarations match the usage example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.