json-file-plus: fix types (#41988)

Some of these types were wrong, and some were missing.
This commit is contained in:
Jordan Harband 2020-02-05 12:55:27 -10:00 committed by GitHub
parent cceda7c3f5
commit f47104d0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -31,5 +31,8 @@
"_comment": "This will remove husky from when we started migrating to use prettier",
"pre-commit": "npm uninstall husky"
}
},
"dependencies": {
"@types/node": "^13.7.0"
}
}

View File

@ -3,13 +3,15 @@
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function readJSON(filename: string): Promise<readJSON.JSONFile>;
declare namespace readJSON {
function sync(filename: string): JSONFile;
interface Format {
readonly indent: number;
readonly indent: number | '\t';
readonly trailing: boolean;
}
@ -17,9 +19,10 @@ declare namespace readJSON {
format: Format;
data: any;
constructor(raw: string);
get: (key: string) => Promise<any>;
get: (key: PropertyKey) => Promise<any>;
set: (data: any) => void;
remove: (key: string) => Promise<void>;
remove: (key: PropertyKey) => Promise<void>;
stringify: () => Buffer;
}
class JSONFile extends JSONData {