@@ -2731,7 +2731,7 @@ namespace ts {
2731
2731
}
2732
2732
2733
2733
function symbolToParameterDeclaration(parameterSymbol: Symbol): ParameterDeclaration {
2734
- const parameterDeclaration = <ParameterDeclaration>getDeclarationOfKind (parameterSymbol, SyntaxKind.Parameter);
2734
+ const parameterDeclaration = getDeclarationOfKind <ParameterDeclaration>(parameterSymbol, SyntaxKind.Parameter);
2735
2735
const parameterType = getTypeOfSymbol(parameterSymbol);
2736
2736
const parameterTypeNode = typeToTypeNodeHelper(parameterType);
2737
2737
// TODO(aozgaa): In the future, check initializer accessibility.
@@ -4100,7 +4100,7 @@ namespace ts {
4100
4100
const func = <FunctionLikeDeclaration>declaration.parent;
4101
4101
// For a parameter of a set accessor, use the type of the get accessor if one is present
4102
4102
if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) {
4103
- const getter = <AccessorDeclaration>getDeclarationOfKind (declaration.parent.symbol, SyntaxKind.GetAccessor);
4103
+ const getter = getDeclarationOfKind <AccessorDeclaration>(declaration.parent.symbol, SyntaxKind.GetAccessor);
4104
4104
if (getter) {
4105
4105
const getterSignature = getSignatureFromDeclaration(getter);
4106
4106
const thisParameter = getAccessorThisParameter(func as AccessorDeclaration);
@@ -4389,8 +4389,8 @@ namespace ts {
4389
4389
function getTypeOfAccessors(symbol: Symbol): Type {
4390
4390
const links = getSymbolLinks(symbol);
4391
4391
if (!links.type) {
4392
- const getter = <AccessorDeclaration>getDeclarationOfKind (symbol, SyntaxKind.GetAccessor);
4393
- const setter = <AccessorDeclaration>getDeclarationOfKind (symbol, SyntaxKind.SetAccessor);
4392
+ const getter = getDeclarationOfKind <AccessorDeclaration>(symbol, SyntaxKind.GetAccessor);
4393
+ const setter = getDeclarationOfKind <AccessorDeclaration>(symbol, SyntaxKind.SetAccessor);
4394
4394
4395
4395
if (getter && getter.flags & NodeFlags.JavaScriptFile) {
4396
4396
const jsDocType = getTypeForDeclarationFromJSDocComment(getter);
@@ -4439,7 +4439,7 @@ namespace ts {
4439
4439
if (!popTypeResolution()) {
4440
4440
type = anyType;
4441
4441
if (noImplicitAny) {
4442
- const getter = <AccessorDeclaration>getDeclarationOfKind (symbol, SyntaxKind.GetAccessor);
4442
+ const getter = getDeclarationOfKind <AccessorDeclaration>(symbol, SyntaxKind.GetAccessor);
4443
4443
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
4444
4444
}
4445
4445
}
@@ -4916,7 +4916,7 @@ namespace ts {
4916
4916
return unknownType;
4917
4917
}
4918
4918
4919
- let declaration: JSDocTypedefTag | TypeAliasDeclaration = <JSDocTypedefTag>getDeclarationOfKind (symbol, SyntaxKind.JSDocTypedefTag);
4919
+ let declaration: JSDocTypedefTag | TypeAliasDeclaration = getDeclarationOfKind <JSDocTypedefTag>(symbol, SyntaxKind.JSDocTypedefTag);
4920
4920
let type: Type;
4921
4921
if (declaration) {
4922
4922
if (declaration.jsDocTypeLiteral) {
@@ -4927,7 +4927,7 @@ namespace ts {
4927
4927
}
4928
4928
}
4929
4929
else {
4930
- declaration = <TypeAliasDeclaration>getDeclarationOfKind (symbol, SyntaxKind.TypeAliasDeclaration);
4930
+ declaration = getDeclarationOfKind <TypeAliasDeclaration>(symbol, SyntaxKind.TypeAliasDeclaration);
4931
4931
type = getTypeFromTypeNode(declaration.type);
4932
4932
}
4933
4933
@@ -6220,7 +6220,7 @@ namespace ts {
6220
6220
!hasDynamicName(declaration) &&
6221
6221
(!hasThisParameter || !thisParameter)) {
6222
6222
const otherKind = declaration.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
6223
- const other = <AccessorDeclaration>getDeclarationOfKind (declaration.symbol, otherKind);
6223
+ const other = getDeclarationOfKind <AccessorDeclaration>(declaration.symbol, otherKind);
6224
6224
if (other) {
6225
6225
thisParameter = getAnnotatedAccessorThisParameter(other);
6226
6226
}
@@ -6263,7 +6263,7 @@ namespace ts {
6263
6263
// TypeScript 1.0 spec (April 2014):
6264
6264
// If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.
6265
6265
if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) {
6266
- const setter = <AccessorDeclaration>getDeclarationOfKind (declaration.symbol, SyntaxKind.SetAccessor);
6266
+ const setter = getDeclarationOfKind <AccessorDeclaration>(declaration.symbol, SyntaxKind.SetAccessor);
6267
6267
return getAnnotatedAccessorType(setter);
6268
6268
}
6269
6269
@@ -6476,7 +6476,7 @@ namespace ts {
6476
6476
}
6477
6477
6478
6478
function getConstraintDeclaration(type: TypeParameter) {
6479
- return ( <TypeParameterDeclaration>getDeclarationOfKind (type.symbol, SyntaxKind.TypeParameter) ).constraint;
6479
+ return getDeclarationOfKind <TypeParameterDeclaration>(type.symbol, SyntaxKind.TypeParameter).constraint;
6480
6480
}
6481
6481
6482
6482
function getConstraintFromTypeParameter(typeParameter: TypeParameter): Type {
@@ -12559,7 +12559,7 @@ namespace ts {
12559
12559
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
12560
12560
if (functionDecl.type ||
12561
12561
functionDecl.kind === SyntaxKind.Constructor ||
12562
- functionDecl.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(<SetAccessorDeclaration>getDeclarationOfKind (functionDecl.symbol, SyntaxKind.SetAccessor))) {
12562
+ functionDecl.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(getDeclarationOfKind <SetAccessorDeclaration>(functionDecl.symbol, SyntaxKind.SetAccessor))) {
12563
12563
return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));
12564
12564
}
12565
12565
@@ -18102,7 +18102,7 @@ namespace ts {
18102
18102
// TypeScript 1.0 spec (April 2014): 8.4.3
18103
18103
// Accessors for the same member name must specify the same accessibility.
18104
18104
const otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
18105
- const otherAccessor = <AccessorDeclaration>getDeclarationOfKind (node.symbol, otherKind);
18105
+ const otherAccessor = getDeclarationOfKind <AccessorDeclaration>(node.symbol, otherKind);
18106
18106
if (otherAccessor) {
18107
18107
if ((getModifierFlags(node) & ModifierFlags.AccessibilityModifier) !== (getModifierFlags(otherAccessor) & ModifierFlags.AccessibilityModifier)) {
18108
18108
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
@@ -20234,7 +20234,7 @@ namespace ts {
20234
20234
}
20235
20235
20236
20236
function isGetAccessorWithAnnotatedSetAccessor(node: FunctionLikeDeclaration) {
20237
- return !!(node.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(<SetAccessorDeclaration>getDeclarationOfKind (node.symbol, SyntaxKind.SetAccessor)));
20237
+ return !!(node.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(getDeclarationOfKind <SetAccessorDeclaration>(node.symbol, SyntaxKind.SetAccessor)));
20238
20238
}
20239
20239
20240
20240
function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration, returnType: Type): boolean {
@@ -20922,7 +20922,7 @@ namespace ts {
20922
20922
checkTypeParameterListsIdentical(symbol);
20923
20923
20924
20924
// Only check this symbol once
20925
- const firstInterfaceDecl = <InterfaceDeclaration>getDeclarationOfKind (symbol, SyntaxKind.InterfaceDeclaration);
20925
+ const firstInterfaceDecl = getDeclarationOfKind <InterfaceDeclaration>(symbol, SyntaxKind.InterfaceDeclaration);
20926
20926
if (node === firstInterfaceDecl) {
20927
20927
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
20928
20928
const typeWithThis = getTypeWithThisArgument(type);
0 commit comments