From 0c1ba2deb0c6b5ce2624974e4ae4d87995adb054 Mon Sep 17 00:00:00 2001 From: Mitchell Grice Date: Mon, 10 Aug 2020 21:17:41 +1000 Subject: [PATCH] Narrow type definition for element type Makes the types for `element.type` more specific --- types/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 0d60adf..8999efa 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -8,6 +8,8 @@ export interface DeclarationAttributes { standalone?: 'yes' | 'no' } +export type ElementType = "instruction" | "text" | "comment" | "cdata" | "doctype" | "element"; + export interface ElementCompact { [key: string]: any _declaration?: { @@ -33,7 +35,7 @@ export interface Element { doctype?: string comment?: string text?: string | number | boolean - type?: string + type?: ElementType name?: string elements?: Array }