docs/libs/typescript.js
function narrowType(type, expr, assumeTrue) {
                switch (expr.kind) {
                    case 69 /* Identifier */:
                    case 97 /* ThisKeyword */:
                    case 172 /* PropertyAccessExpression */:
                        return narrowTypeByTruthiness(type, expr, assumeTrue);
                    case 174 /* CallExpression */:
                        return narrowTypeByTypePredicate(type, expr, assumeTrue);
                    case 178 /* ParenthesizedExpression */:
                        return narrowType(type, expr.expression, assumeTrue);
                    case 187 /* BinaryExpression */:
                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);
                    case 185 /* PrefixUnaryExpression */:
                        if (expr.operator === 49 /* ExclamationToken */) {
                            return narrowType(type, expr.operand, !assumeTrue);
                        }
                        break;
                }
                return type;
            }
function narrowType(type, expr, assumeTrue) {
                switch (expr.kind) {
                    case 69 /* Identifier */:
                    case 97 /* ThisKeyword */:
                    case 172 /* PropertyAccessExpression */:
                        return narrowTypeByTruthiness(type, expr, assumeTrue);
                    case 174 /* CallExpression */:
                        return narrowTypeByTypePredicate(type, expr, assumeTrue);
                    case 178 /* ParenthesizedExpression */:
                        return narrowType(type, expr.expression, assumeTrue);
                    case 187 /* BinaryExpression */:
                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);
                    case 185 /* PrefixUnaryExpression */:
                        if (expr.operator === 49 /* ExclamationToken */) {
                            return narrowType(type, expr.operand, !assumeTrue);
                        }
                        break;
                }
                return type;
            }
function narrowType ( type , expr , assumeTrue ) { switch ( expr . kind ) { case 69 /* Identifier */ : case 97 /* ThisKeyword */ : case 172 /* PropertyAccessExpression */ : return narrowTypeByTruthiness ( type , expr , assumeTrue ) ; case 174 /* CallExpression */ : return narrowTypeByTypePredicate ( type , expr , assumeTrue ) ; case 178 /* ParenthesizedExpression */ : return narrowType ( type , expr . expression , assumeTrue ) ; case 187 /* BinaryExpression */ : return narrowTypeByBinaryExpression ( type , expr , assumeTrue ) ; case 185 /* PrefixUnaryExpression */ : if ( expr . operator === 49 /* ExclamationToken */ ) { return narrowType ( type , expr . operand , ! assumeTrue ) ; } break ; } return type ; }
Narrow the given type based on the given expression having the assumed boolean value. The returned type will be a subtype or the same type as the argument.
Narrow the given type based on the given expression having the assumed boolean value . The returned type will be a subtype or the same type as the argument .