📜  for (... in ...) 语句必须使用 if 语句 (forin) 过滤 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:12.827000             🧑  作者: Mango

代码示例2
function isFiltered({statements}: ts.Block): boolean {
    switch (statements.length) {
        case 0: return true;
        case 1: return statements[0].kind === ts.SyntaxKind.IfStatement;
        default:
            return statements[0].kind === ts.SyntaxKind.IfStatement && nodeIsContinue((statements[0] as ts.IfStatement).thenStatement);
    }

}