* Returns the node more strictly typed iff it is of the given type. Otherwise, * returns null.
(node, type)
| 5989 | */ |
| 5990 | |
| 5991 | function checkNodeType(node, type) { |
| 5992 | if (node && node.type === type) { |
| 5993 | // The definition of ParseNode<TYPE> doesn't communicate to flow that |
| 5994 | // `type: TYPE` (as that's not explicitly mentioned anywhere), though that |
| 5995 | // happens to be true for all our value types. |
| 5996 | // $FlowFixMe |
| 5997 | return node; |
| 5998 | } |
| 5999 | |
| 6000 | return null; |
| 6001 | } |
| 6002 | /** |
| 6003 | * Asserts that the node is of the given type and returns it with stricter |
| 6004 | * typing. Throws if the node's type does not match. |
no outgoing calls
no test coverage detected