mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
write-pkg: add library definitions.
This commit is contained in:
15
types/write-pkg/index.d.ts
vendored
Normal file
15
types/write-pkg/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for write-pkg 3.1
|
||||
// Project: https://github.com/sindresorhus/write-pkg#readme
|
||||
// Definitions by: Aleh Zasypkin <https://github.com/azasypkin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface WritePkg {
|
||||
(path: string, data: { [k: string]: any }): Promise<void>;
|
||||
(data: { [k: string]: any }): Promise<void>;
|
||||
sync(path: string, data: { [k: string]: any }): void;
|
||||
sync(data: { [k: string]: any }): void;
|
||||
}
|
||||
|
||||
declare const writePkg: WritePkg;
|
||||
|
||||
export = writePkg;
|
||||
23
types/write-pkg/tsconfig.json
Normal file
23
types/write-pkg/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",
|
||||
"write-pkg-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/write-pkg/tslint.json
Normal file
1
types/write-pkg/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
6
types/write-pkg/write-pkg-tests.ts
Normal file
6
types/write-pkg/write-pkg-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import WritePkg = require('write-pkg');
|
||||
|
||||
WritePkg('package.json', { version: 1 }); // $ExpectType Promise<void>
|
||||
WritePkg({ version: 1 }); // $ExpectType Promise<void>
|
||||
WritePkg.sync('package.json', { version: 1 }); // $ExpectType void
|
||||
WritePkg.sync({ version: 1 }); // $ExpectType void
|
||||
Reference in New Issue
Block a user