mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
read-json-sync: initial definition (#43755)
This commit is contained in:
15
types/read-json-sync/index.d.ts
vendored
Normal file
15
types/read-json-sync/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for read-json-sync 2.0
|
||||
// Project: https://github.com/shinnn/read-json-sync#readme
|
||||
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.1
|
||||
|
||||
/// <reference types="node"/>
|
||||
import { readFileSync } from "fs";
|
||||
import { URL } from "url";
|
||||
|
||||
type ReadFileOptions = Extract<Parameters<typeof readFileSync>[1], object>;
|
||||
|
||||
declare function readJsonSync(path: string|Buffer|URL|number, options?: ReadFileOptions|string): any;
|
||||
|
||||
export = readJsonSync;
|
||||
4
types/read-json-sync/read-json-sync-tests.ts
Normal file
4
types/read-json-sync/read-json-sync-tests.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import readJsonSync = require("read-json-sync");
|
||||
|
||||
readJsonSync("file.json", "utf8");
|
||||
readJsonSync(1, { encoding: "gb2312" });
|
||||
23
types/read-json-sync/tsconfig.json
Normal file
23
types/read-json-sync/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"read-json-sync-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/read-json-sync/tslint.json
Normal file
1
types/read-json-sync/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user