当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript base.fail函数代码示例

本文整理汇总了TypeScript中basic/base.fail函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fail函数的具体用法?TypeScript fail怎么用?TypeScript fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fail函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: dareParseNumberAt

export function dareParseNumberAt(args: string[], at: number, failure: string): number {
    const value = args[at];
    if (value === undefined) return fail(failure + ' ' + parseNumberFailure);
    const parsed = mightParseInteger(value);
    if (thereIsNo(parsed)) return fail(failure + ' ' + parseNumberFailure + ' ' + whyNo(parsed));
    return parsed;
}
开发者ID:aleksey-bykov,项目名称:commandlining,代码行数:7,代码来源:primitive.ts

示例2: verifyIdentifier

function verifyIdentifier(node: ts.Identifier, checker: ts.TypeChecker): Issue | void {
    if (node.parent === undefined) return;
    if (isVariableDeclaration(node.parent) && node.parent.initializer === node) return;

    const symbol = checker.getSymbolAtLocation(node);
    if (symbol === undefined) return fail('Unable to get symbol.');
    const declared = symbol.getDeclarations();
    if (declared === undefined) return fail('There is no declaration.');
    if (declared.length < 1) return fail('There are ' + declared.length + ' declarations.');
    const declaration = declared[0];
    if (isVariableDeclaration(declaration) && hasConstModifier(declaration)) {
        return issueFrom(node, 'const returned', 'no-const-lambdas');
    }
}
开发者ID:aleksey-bykov,项目名称:rules,代码行数:14,代码来源:rule.ts

示例3: haveCompiled

export function betterBeNoIssues<r>(tried: TriedCompiling, haveCompiled: (compiled: Compiled) => r): r {

    if (bt.isLuck(tried)) {
        return haveCompiled(tried.luck);
    } else {

        const issues = ba.fromList(tried.fuck);
        ba.forEach(issues, issue => {
            console.warn(formatDiagnostic(issue));
        });

        return bb.fail('Stopped due to detected issues.');
    }
}
开发者ID:aleksey-bykov,项目名称:linting,代码行数:14,代码来源:compiling-assertions.ts

示例4: toUnexpectedState

export function toUnexpectedState(_: never): never {
    return fail('Unhandled state.');
}
开发者ID:aleksey-bykov,项目名称:commandlining,代码行数:3,代码来源:parsing.ts

示例5: willBeServing

willBeServing(async () => {
    return fail('!!!');
});
开发者ID:zpdDG4gta8XKpMCd,项目名称:wh3,代码行数:3,代码来源:run.ts

示例6: dare

 dare(failure: string, format: (fail: b) => string): a {
     return isLuck(this.value) ? this.value.luck : fail(failure + ' ' + format(this.value.fuck));
 }
开发者ID:aleksey-bykov,项目名称:fluent,代码行数:3,代码来源:trying.ts

示例7: dareAt

export function dareAt(args: string[], at: number, failure: string): string {
    const value = args[at];
    if (value === undefined) return fail(failure);
    return value;
}
开发者ID:aleksey-bykov,项目名称:commandlining,代码行数:5,代码来源:primitive.ts


注:本文中的basic/base.fail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。