Add type definitions for find-java-home 0.2

This commit is contained in:
sjx233
2018-12-15 13:21:39 +08:00
parent 39b514a4bb
commit e2df587361
4 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import findJavaHome = require("find-java-home");
import { promisify } from "util";
findJavaHome(() => { }); // $ExpectType void
findJavaHome({ allowJre: true }, () => { }); // $ExpectType void
promisify(findJavaHome); // $ExpectType (options?: { allowJre?: boolean | undefined; } | undefined) => Promise<string>

15
types/find-java-home/index.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
// Type definitions for find-java-home 0.2
// Project: https://github.com/jsdevel/node-find-java-home
// Definitions by: sjx233 <https://github.com/sjx233>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function findJavaHome(callback: (err: Error | undefined, home: string) => void): void;
declare function findJavaHome(options: { allowJre?: boolean }, callback: (err: Error | undefined, home: string) => void): void;
declare namespace findJavaHome {
function __promisify__(options?: { allowJre?: boolean }): Promise<string>;
}
export = findJavaHome;

View File

@@ -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",
"find-java-home-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }