@@ -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 {
@@ -12567,7 +12567,7 @@ namespace ts {
12567
12567
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
12568
12568
if (functionDecl.type ||
12569
12569
functionDecl.kind === SyntaxKind.Constructor ||
12570
- functionDecl.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(<SetAccessorDeclaration>getDeclarationOfKind (functionDecl.symbol, SyntaxKind.SetAccessor))) {
12570
+ functionDecl.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(getDeclarationOfKind <SetAccessorDeclaration>(functionDecl.symbol, SyntaxKind.SetAccessor))) {
12571
12571
return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl));
12572
12572
}
12573
12573
@@ -18110,7 +18110,7 @@ namespace ts {
18110
18110
// TypeScript 1.0 spec (April 2014): 8.4.3
18111
18111
// Accessors for the same member name must specify the same accessibility.
18112
18112
const otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
18113
- const otherAccessor = <AccessorDeclaration>getDeclarationOfKind (node.symbol, otherKind);
18113
+ const otherAccessor = getDeclarationOfKind <AccessorDeclaration>(node.symbol, otherKind);
18114
18114
if (otherAccessor) {
18115
18115
if ((getModifierFlags(node) & ModifierFlags.AccessibilityModifier) !== (getModifierFlags(otherAccessor) & ModifierFlags.AccessibilityModifier)) {
18116
18116
error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
@@ -20242,7 +20242,7 @@ namespace ts {
20242
20242
}
20243
20243
20244
20244
function isGetAccessorWithAnnotatedSetAccessor(node: FunctionLikeDeclaration) {
20245
- return !!(node.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(<SetAccessorDeclaration>getDeclarationOfKind (node.symbol, SyntaxKind.SetAccessor)));
20245
+ return !!(node.kind === SyntaxKind.GetAccessor && getSetAccessorTypeAnnotationNode(getDeclarationOfKind <SetAccessorDeclaration>(node.symbol, SyntaxKind.SetAccessor)));
20246
20246
}
20247
20247
20248
20248
function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration, returnType: Type): boolean {
@@ -20930,7 +20930,7 @@ namespace ts {
20930
20930
checkTypeParameterListsIdentical(symbol);
20931
20931
20932
20932
// Only check this symbol once
20933
- const firstInterfaceDecl = <InterfaceDeclaration>getDeclarationOfKind (symbol, SyntaxKind.InterfaceDeclaration);
20933
+ const firstInterfaceDecl = getDeclarationOfKind <InterfaceDeclaration>(symbol, SyntaxKind.InterfaceDeclaration);
20934
20934
if (node === firstInterfaceDecl) {
20935
20935
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
20936
20936
const typeWithThis = getTypeWithThisArgument(type);
0 commit comments