You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usually we want to avoid any in TypeScript, it basically means "ignore my type" to TypeScript.
Here's what I had before, from the @types repo:
// Type definitions for filesize 4.2// Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>// Renaud Chaput <https://github.com/renchap>// Roman Nuritdinov <https://github.com/Ky6uk>// Sam Hulick <https://github.com/ffxsam>// Definitions: https://github.com/DefinitelyTyped/DefinitelyTypeddeclarevarfileSize: Filesize.Filesize;export=fileSize;exportasnamespacefilesize;declarenamespaceFilesize{interfaceSiJedecBits{b?: string;Kb?: string;Mb?: string;Gb?: string;Tb?: string;Pb?: string;Eb?: string;Zb?: string;Yb?: string;}interfaceSiJedecBytes{B?: string;KB?: string;MB?: string;GB?: string;TB?: string;PB?: string;EB?: string;ZB?: string;YB?: string;}typeSiJedec=SiJedecBits&SiJedecBytes&{[name: string]: string};interfaceOptions{/** * Number base, default is 2 */base?: number;/** * Enables bit sizes, default is false */bits?: boolean;/** * Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1 */exponent?: number;/** * Enables full form of unit of measure, default is false */fullform?: boolean;/** * Array of full form overrides, default is [] */fullforms?: string[];/** * BCP 47 language tag to specify a locale, or true to use default locale, default is "" */locale?: string|boolean;/** * ECMA-402 number format option overrides, default is "{}" */localeOptions?: Intl.NumberFormatOptions;/** * Output of function (array, exponent, object, or string), default is string */output?: "array"|"exponent"|"object"|"string";/** * Decimal place, default is 2 */round?: number;/** * Decimal separator character, default is `.` */separator?: string;/** * Character between the result and suffix, default is ` ` */spacer?: string;/** * Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base */standard?: "iec"|"jedec";/** * Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found */symbols?: SiJedec;/** * Enables unix style human readable output, e.g ls -lh, default is false */unix?: boolean;}interfaceFilesize{(bytes: number,options?: Options): string;partial: (options: Options)=>((bytes: number)=>string);}}
Hi, thanks for adding typescript types!
It seems that they aren't correct, making this unusable in Typescript when type checking is enabled.
Usually we want to avoid
any
in TypeScript, it basically means "ignore my type" to TypeScript.Here's what I had before, from the
@types
repo:Source: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/filesize/index.d.ts
The text was updated successfully, but these errors were encountered: