From ae533551c29fe4fd9f8dfa214400ff44a85124b9 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sun, 9 Jul 2017 18:50:45 +0100 Subject: [PATCH] Allow visitors to return undefined While implementing `ts.Visitor`, it is possible to return `undefined` in order to drop a node. However, the typings do not reflect this and only allow to return `Node | Node []`. This PR extends the typings to allow `undefined` as well. --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 63b50d58e4a..da69c407ac8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4350,7 +4350,7 @@ namespace ts { */ export type Visitor = (node: Node) => VisitResult; - export type VisitResult = T | T[]; + export type VisitResult = T | T[] | undefined; export interface Printer { /**