Remove redundant throws of Debug.assertNever (#53405)

This commit is contained in:
Jake Bailey 2023-03-21 16:04:06 -07:00 committed by GitHub
parent 3f90887a6e
commit 2c952fe850
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View File

@ -4736,7 +4736,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
else {
throw Debug.assertNever(name, "Unknown entity name kind.");
Debug.assertNever(name, "Unknown entity name kind.");
}
Debug.assert((getCheckFlags(symbol) & CheckFlags.Instantiated) === 0, "Should never get an instantiated symbol here.");
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & SymbolFlags.Alias || name.parent.kind === SyntaxKind.ExportAssignment)) {
@ -17040,7 +17040,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
links.resolvedType = getTypeFromTypeNode(node.type);
break;
default:
throw Debug.assertNever(node.operator);
Debug.assertNever(node.operator);
}
}
return links.resolvedType;
@ -33962,7 +33962,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
case SyntaxKind.JsxSelfClosingElement:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
}
/**
@ -47701,7 +47701,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
currentKind = DeclarationMeaning.SetAccessor;
break;
default:
throw Debug.assertNever(prop, "Unexpected syntax kind:" + (prop as Node).kind);
Debug.assertNever(prop, "Unexpected syntax kind:" + (prop as Node).kind);
}
if (!inDestructuring) {

View File

@ -467,6 +467,6 @@ function renderPackageNameValidationFailureWorker(typing: string, result: NameVa
case NameValidationResult.Ok:
return Debug.fail(); // Shouldn't have called this.
default:
throw Debug.assertNever(result);
Debug.assertNever(result);
}
}

View File

@ -656,7 +656,7 @@ function getClassificationTypeName(type: ClassificationType): ClassificationType
case ClassificationType.jsxAttribute: return ClassificationTypeNames.jsxAttribute;
case ClassificationType.jsxText: return ClassificationTypeNames.jsxText;
case ClassificationType.jsxAttributeStringLiteralValue: return ClassificationTypeNames.jsxAttributeStringLiteralValue;
default: return undefined!; // TODO: GH#18217 throw Debug.assertNever(type);
default: return undefined!; // TODO: GH#18217 Debug.assertNever(type);
}
}

View File

@ -67,7 +67,7 @@ interface Info {
function getInfo(sourceFile: SourceFile, program: Program, pos: number): Info | undefined {
const { parent } = getTokenAtPosition(sourceFile, pos);
if (!isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ true)) {
throw Debug.failBadSyntaxKind(parent);
Debug.failBadSyntaxKind(parent);
}
const decl = cast(parent.parent, isVariableDeclaration);

View File

@ -1001,7 +1001,7 @@ function getDescriptionForFunctionLikeDeclaration(scope: FunctionLikeDeclaration
case SyntaxKind.SetAccessor:
return `'set ${scope.name.getText()}'`;
default:
throw Debug.assertNever(scope, `Unexpected scope kind ${(scope as FunctionLikeDeclaration).kind}`);
Debug.assertNever(scope, `Unexpected scope kind ${(scope as FunctionLikeDeclaration).kind}`);
}
}
function getDescriptionForClassLikeDeclaration(scope: ClassLikeDeclaration): string {