Improve type definitions for sizeof (#41517)

This commit is contained in:
Daniel Perez Alvarez
2020-01-10 15:04:57 -08:00
committed by Armando Aguirre
parent 282f273e8b
commit 17cb4a9032
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -3,5 +3,6 @@
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function sizeof(object: object, pretty?: boolean): number | string;
export function sizeof(object: any, pretty?: false): number;
export function sizeof(object: any, pretty: true): string;
export function format(bytes: number): string;
+2 -1
View File
@@ -8,6 +8,7 @@ const anyObject = {
},
};
console.log(sizeof(anyObject)); // 50
console.log(sizeof(anyObject) + 0); // 50
console.log(sizeof(anyObject, false) + 0); // 50
console.log(sizeof(anyObject, true)); // 50B
console.log(format(50)); // 50B