From a9314d52555012972063da1b7c7c3396faa8cc3c Mon Sep 17 00:00:00 2001 From: Micah Zoltu Date: Thu, 22 Aug 2019 18:45:06 +0800 Subject: [PATCH] Fixes type definition on watch and Watcher constructor. 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. --- src/watch/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/watch/index.ts b/src/watch/index.ts index 8184ee6813b..5bd0284ee8e 100644 --- a/src/watch/index.ts +++ b/src/watch/index.ts @@ -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) { @@ -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; }