Skip to content

Commit 53d3f29

Browse files
committed
Remove hasTypeArguments
This internal utility function and corresponding type weren't in use, and `hasTypeArguments`'s guarding was buggy: - `node` could be a `NodeWithTypeArguments`, which is not a member of `HasTypeArguments` - else branch narrowing was wrong: `typeArguments` is optional, so it can be undefined while `node` is assignable to `HasTypeArguments`
1 parent b504a1e commit 53d3f29

File tree

3 files changed

+0
-14
lines changed

3 files changed

+0
-14
lines changed

src/compiler/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,13 +1293,6 @@ export type HasIllegalTypeParameters =
12931293
| SetAccessorDeclaration
12941294
| GetAccessorDeclaration;
12951295

1296-
export type HasTypeArguments =
1297-
| CallExpression
1298-
| NewExpression
1299-
| TaggedTemplateExpression
1300-
| JsxOpeningElement
1301-
| JsxSelfClosingElement;
1302-
13031296
export type HasInitializer =
13041297
| HasExpressionInitializer
13051298
| ForStatement

src/compiler/utilities.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ import {
222222
HasModifiers,
223223
hasProperty,
224224
HasType,
225-
HasTypeArguments,
226225
HeritageClause,
227226
Identifier,
228227
identifierToKeywordKind,
@@ -4751,11 +4750,6 @@ export function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { par
47514750
return typeParameters && find(typeParameters, p => p.name.escapedText === name);
47524751
}
47534752

4754-
/** @internal @knipignore */
4755-
export function hasTypeArguments(node: Node): node is HasTypeArguments {
4756-
return !!(node as HasTypeArguments).typeArguments;
4757-
}
4758-
47594753
/** @internal */
47604754
export const enum AssignmentKind {
47614755
None,

tests/baselines/reference/api/typescript.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4392,7 +4392,6 @@ declare namespace ts {
43924392
| WhileStatement
43934393
| WithStatement;
43944394
type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
4395-
type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
43964395
type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
43974396
type HasExpressionInitializer = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyDeclaration | PropertyAssignment | EnumMember;
43984397
type HasDecorators = ParameterDeclaration | PropertyDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ClassExpression | ClassDeclaration;

0 commit comments

Comments
 (0)