mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Add typings for init-package-json (#29356)
This commit is contained in:
committed by
Wesley Wigham
parent
1038a88306
commit
ce1ee6c93f
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for init-package-json 1.10
|
||||
// Project: https://github.com/npm/init-package-json#readme
|
||||
// Definitions by: Kyle Farnung <https://github.com/kfarnung>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace init_package_json {
|
||||
interface Config {
|
||||
[key: string]: any;
|
||||
get(k: string): any;
|
||||
}
|
||||
|
||||
function yes(conf: Config): boolean;
|
||||
}
|
||||
|
||||
declare function init_package_json(
|
||||
dir: string,
|
||||
input: string,
|
||||
config: init_package_json.Config | {},
|
||||
cb: (err: any, data: any) => void): void;
|
||||
|
||||
declare function init_package_json(
|
||||
dir: string,
|
||||
input: string,
|
||||
cb: (err: any, data: any) => void): void;
|
||||
|
||||
export = init_package_json;
|
||||
@@ -0,0 +1,18 @@
|
||||
import init_package_json = require("init-package-json");
|
||||
|
||||
init_package_json("", "", (err: any, data: any) => {}); // $ExpectType void
|
||||
init_package_json("", "", {}, (err: any, data: any) => {}); // $ExpectType void
|
||||
init_package_json("", "", { foo: "bar" }, (err: any, data: any) => {}); // $ExpectType void
|
||||
|
||||
const config: init_package_json.Config = {
|
||||
foo: "bar",
|
||||
get(k) {
|
||||
return "";
|
||||
},
|
||||
};
|
||||
|
||||
init_package_json("", "", config, (err: any, data: any) => {}); // $ExpectType void
|
||||
|
||||
init_package_json.yes({}); // $ExpectError
|
||||
init_package_json.yes({ foo: "bar" }); // $ExpectError
|
||||
init_package_json.yes(config); // $ExpectType boolean
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"init-package-json-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user