fis `is_head`

pull/7777/head
Ivan Hofer 4 years ago
parent 49c7a34ca2
commit 23d88cd00d

@ -1,9 +1,5 @@
import { Identifier, Node } from 'estree';
import { Node } from 'estree';
type NarrowNodeType<Y> = Y extends { name: string } ? Y : never;
export function is_head(node: Identifier | Node) {
return node && node.type === 'MemberExpression' &&
(node.object as NarrowNodeType<Node>).name === '@_document' &&
(node.property as NarrowNodeType<Node>).name === 'head';
export function is_head(node: Node) {
return node && node.type === 'MemberExpression' && node.object['name'] === '@_document' && node.property['name'] === 'head';
}

Loading…
Cancel
Save