DefinitelyTyped/types/write-json-file/index.d.ts
Dimitri Benin 51bc9336ac [write-json-file] correct typings for indent and sortKeys options (#18808)
* [write-json-file] correct typings for indent and sortKeys options

* [write-json-file] add tests for new typings
2017-08-10 16:34:29 -07:00

19 lines
790 B
TypeScript

// Type definitions for write-json-file 2.2
// Project: https://github.com/sindresorhus/write-json-file
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function writeJsonFile(filepath: string, data: any, options?: writeJsonFile.Options): Promise<void>;
declare namespace writeJsonFile {
type Replacer = (key: string, value: any) => void;
interface Options {
indent?: string | number | null;
detectIndent?: boolean;
sortKeys?: boolean | ((a: string, b: string) => number);
replacer?: Replacer | Array<number | string> | null;
mode?: number;
}
function sync(filepath: string, data: any, options?: Options): void;
}
export = writeJsonFile;