From 901b2ad5187b29eac80a3ca8efa947f41372f43b Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Thu, 19 Oct 2017 12:55:39 +0100 Subject: [PATCH] Node: add and share `ParsedUrlQuery` type --- types/node/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index e54d972797..44c8b68283 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -796,8 +796,10 @@ declare module "querystring" { decodeURIComponent?: Function; } + interface ParsedUrlQuery { [key: string]: string | string[]; } + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; - export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): { [key: string]: string | string[] }; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; export function escape(str: string): string; export function unescape(str: string): string; @@ -2171,6 +2173,8 @@ declare module "child_process" { } declare module "url" { + import { ParsedUrlQuery } from 'querystring'; + export interface InputUrlObject { auth?: string; hash?: string; @@ -2181,7 +2185,7 @@ declare module "url" { pathname?: string; port?: string | number; protocol?: string; - query?: string | null | { [key: string]: string | string[] }; + query?: string | null | ParsedUrlQuery; search?: string; slashes?: boolean; }