Skip to content

Commit

Permalink
json-file-plus: fix types (DefinitelyTyped#41988)
Browse files Browse the repository at this point in the history
Some of these types were wrong, and some were missing.
  • Loading branch information
ljharb authored Feb 5, 2020
1 parent cceda7c commit f47104d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
9 changes: 6 additions & 3 deletions types/json-file-plus/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
// 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;
}

class JSONData {
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 {
Expand Down

0 comments on commit f47104d

Please sign in to comment.