Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 717 Bytes

File metadata and controls

26 lines (17 loc) · 717 Bytes

Home > types-kit > UrlQueryToObject

UrlQueryToObject type

Parser the querystring of a url into an object type

Signature:

export type UrlQueryToObject<T extends string> =
  T extends `${string}?${infer QueryString}`
    ? InternalUrlQueryToObject<QueryString>
    : InternalUrlQueryToObject<T>

References: InternalUrlQueryToObject

Example

// Expect: { a: ['1', '3'], b: '2', c: undefined }
type Foo = UrlQueryToObject<'/foo/bar?a=1&b=2&a=3&c'>