Added new type definition for npm package fb-watchman 2.0.0 (#24825)

This commit is contained in:
Wu Haotian
2018-04-09 09:48:55 -07:00
committed by Mohamed Hegazy
parent 6bd12e9136
commit 89fba32869
4 changed files with 76 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { Client } from "fb-watchman";
const client = new Client();
const clientB = new Client({});
client.capabilityCheck({ optional: [], required: ['relative_root'] }, e => {
if (e) {
client.end();
return;
}
});
client.connect();
client.command(['watch-project', '/tmp'], () => {});
+38
View File
@@ -0,0 +1,38 @@
// Type definitions for fb-watchman 2.0
// Project: https://facebook.github.io/watchman/
// Definitions by: Wu Haotian <https://github.com/whtsky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { EventEmitter } from 'events';
// Emit the responses to these when they get sent down to us
export type UnilateralTags = 'unilateralTags' | 'log';
export interface ClientOptions {
/**
* Absolute path to the watchman binary.
* If not provided, the Client locates the binary using the PATH specified
* by the node child_process's default env.
*/
watchmanBinaryPath?: string;
}
export interface Capabilities {
optional: any[];
required: any[];
}
export type doneCallback = (error?: Error | null, resp?: any) => any;
export class Client extends EventEmitter {
constructor(options?: ClientOptions)
sendNextCommand(): void;
cancelCommands(why: string): void;
connect(): void;
command(args: any, done: doneCallback): void;
capabilityCheck(
caps: Capabilities,
done: doneCallback,
): void;
end(): void;
}
+23
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",
"fb-watchman-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }