Remove checkNodeType and assert/checkAtomFamily (#2137)

We used functions with $FlowFixMe as Flow couldn't refine ParseNode 
using its type. It seems the issue has been fixed and complicated 
function calls can be removed.
This commit is contained in:
ylemkimon
2019-11-30 05:08:22 +09:00
committed by Kevin Barabash
parent 981a9ea3a0
commit fa8fbc0c18
11 changed files with 55 additions and 135 deletions

View File

@@ -1,6 +1,4 @@
// @flow
import {checkNodeType} from "./parseNode";
import type Parser from "./Parser";
import type {ParseNode, AnyParseNode, NodeType, UnsupportedCmdParseNode}
from "./parseNode";
@@ -228,6 +226,5 @@ export function defineFunctionBuilders<NODETYPE: NodeType>({
// Since the corresponding buildHTML/buildMathML function expects a
// list of elements, we normalize for different kinds of arguments
export const ordargument = function(arg: AnyParseNode): AnyParseNode[] {
const node = checkNodeType(arg, "ordgroup");
return node ? node.body : [arg];
return arg.type === "ordgroup" ? arg.body : [arg];
};