From 5afe412a64546765e771e8ca4891977eef628e66 Mon Sep 17 00:00:00 2001 From: Gabriel Cangussu Date: Tue, 24 Mar 2020 21:38:51 -0300 Subject: [PATCH] [valid-url] Fixed return and argument type (#43332) --- types/valid-url/index.d.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/types/valid-url/index.d.ts b/types/valid-url/index.d.ts index c4cc826b7f..b5e8f8df12 100644 --- a/types/valid-url/index.d.ts +++ b/types/valid-url/index.d.ts @@ -1,15 +1,16 @@ // Type definitions for valid-url v1.0.9 // Project: https://github.com/ogt/valid-url // Definitions by: Steve Hipwell +// Gabriel Cangussu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** * Is the value a well-formed uri? * Returns the untainted URI if the test value appears to be well-formed. Note that you may really want one of the more practical methods like is_http_uri or is_https_uri, since the URI standard (RFC 3986) allows a lot of things you probably don't want. - * @param {string} value - The potential URI to test. - * @returns {string} - The untainted RFC 3986 URI on success, undefined on failure. + * @param value - The potential URI to test. + * @returns The untainted RFC 3986 URI on success, undefined on failure. */ -export function isUri(value: any): string; +export function isUri(value: string): string | undefined; /** * Is the value a well-formed HTTP uri? @@ -20,24 +21,24 @@ export function isUri(value: any): string; * Note that you probably want to either call this in combo with is_https_uri(). * i.e. if(isHttpUri(uri) || isHttpsUri(uri)) console.log('Good'); * or use the convenience method isWebUri which is equivalent. -* @param {string} value - The potential URI to test. -* @returns {string} - The untainted RFC 3986 URI on success, undefined on failure. +* @param value - The potential URI to test. +* @returns The untainted RFC 3986 URI on success, undefined on failure. */ -export function isHttpUri(value: any): string; +export function isHttpUri(value: string): string | undefined; /** * Is the value a well-formed HTTPS uri? *See is_http_uri() for details. This version only likes the https URI scheme. Otherwise it's identical to is_http_uri(). -* @param {string} value - The potential URI to test. -* @returns {string} - The untainted RFC 3986 URI on success, undefined on failure. +* @param value - The potential URI to test. +* @returns The untainted RFC 3986 URI on success, undefined on failure. */ -export function isHttpsUri(value: any): string; +export function isHttpsUri(value: string): string | undefined; /** * Is the value a well-formed HTTP or HTTPS uri? * This is just a convenience method that combines isHttpUri and isHttpsUri to accept most common real-world URLs. -* @param {string} value - The potential URI to test. -* @returns {string} - The untainted RFC 3986 URI on success, undefined on failure. +* @param value - The potential URI to test. +* @returns The untainted RFC 3986 URI on success, undefined on failure. */ -export function isWebUri(value: any): string; +export function isWebUri(value: string): string | undefined;