Skip to content

Commit

Permalink
Fixes type definition on watch and Watcher constructor. (#3074)
Browse files Browse the repository at this point in the history
As seen on line 42, this function actually accepts either a `GenericConfigObject[]` or a `GenericConfigObject`.  The documentation uses the non-array form, which results in a user following the documentation in TypeScript getting a type checker error.
  • Loading branch information
MicahZoltu authored and lukastaegert committed Aug 22, 2019
1 parent 54dfb28 commit 0314917
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/watch/index.ts
Expand Up @@ -28,7 +28,7 @@ export class Watcher {
private succeeded = false;
private tasks: Task[];

constructor(configs: GenericConfigObject[]) {
constructor(configs: GenericConfigObject[] | GenericConfigObject) {
this.emitter = new (class extends EventEmitter implements RollupWatcher {
close: () => void;
constructor(close: () => void) {
Expand Down Expand Up @@ -279,6 +279,6 @@ export class Task {
}
}

export default function watch(configs: GenericConfigObject[]): RollupWatcher {
export default function watch(configs: GenericConfigObject[] | GenericConfigObject): RollupWatcher {
return new Watcher(configs).emitter;
}

0 comments on commit 0314917

Please sign in to comment.