mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Improve type definitions for sizeof (#41517)
This commit is contained in:
committed by
Armando Aguirre
parent
282f273e8b
commit
17cb4a9032
Vendored
+2
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user