diff --git a/packages/pretty-format/src/plugins/HTMLElement.js b/packages/pretty-format/src/plugins/HTMLElement.js index eb1ebe9d5698..f85d47064c33 100644 --- a/packages/pretty-format/src/plugins/HTMLElement.js +++ b/packages/pretty-format/src/plugins/HTMLElement.js @@ -57,17 +57,17 @@ function printAttributes(attributes, print, indent, colors, opts) { } const print = ( - element: any, + element: HTMLElement | Text | Comment, print: Print, indent: Indent, opts: Options, colors: Colors, -) => { - if (element.nodeType === 3) { +): string => { + if (element instanceof Text) { return element.data; } - if (element.nodeType === 8) { + if (element instanceof Comment) { return ``; }