DefinitelyTyped/types/pathwatcher
2017-10-23 07:46:49 -07:00
..
v0
index.d.ts Revamp services. Improve consistency. Add *Compatible types. (#20726) 2017-10-23 07:46:49 -07:00
pathwatcher-tests.ts Revamp services. Improve consistency. Add *Compatible types. (#20726) 2017-10-23 07:46:49 -07:00
README.md Revamp services. Improve consistency. Add *Compatible types. (#20726) 2017-10-23 07:46:49 -07:00
tsconfig.json
tslint.json Revamp services. Improve consistency. Add *Compatible types. (#20726) 2017-10-23 07:46:49 -07:00

Path Watcher Node Type Definitions

TypeScript type definitions for [Path Watcher Node], which is published as "pathwatcher" on NPM.

Usage Notes

Exports

The two classes exported from this module are: File and Directory.

import { File, Directory } from "text-buffer";

Additionally, the following functions are exported as well:

watch(): PathWatcher.PathWatcher;
closeAllWatchers(): void;
getWatchedPaths(): string[];

The PathWatcher Namespace

All types used by Path Watcher can be referenced from the PathWatcher namespace.

function example(file: PathWatcher.File) {}

Exposing Private Methods and Properties

Declaration Merging can be used to augment any of the types used within Path Watcher. As an example, if we wanted to reveal the private setPath method within the File class, then we would create a file with the following contents:

// <<filename>>.d.ts

declare namespace PathWatcher {
  interface File {
    setPath(path: string): void;
  }
}

Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the File class without TypeScript reporting errors.