🤖 Merge PR #46919 [is-number] Changed return type of isNumber to boolean by @hettlage

The previous return type gave an error ("Property 'split' does not exist on type 'never'.  TS2339") when the following code is compiled with TypeScript 3.9.7:

const s = "13:09:42";
if (isNumber(s)) {
  console.log(`${s} hours`);
} else {
  const hours = s.split(":");
  console.log(`${hours} hours`);
}
This commit is contained in:
hettlage 2020-09-05 10:57:03 +02:00 committed by GitHub
parent 679571bbfc
commit 4d4da2106d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,4 +11,4 @@ export = is_number;
* @param num Any value that should be tested for being a number
* @returns true if the parameter is a valid number, otherwise false
*/
declare function is_number(num: any): num is number | string;
declare function is_number(num: any): boolean;