avoid more useless type assertions (#31239)
This commit is contained in:
parent
b365e657d4
commit
4ee0084fa1
5 changed files with 9 additions and 7 deletions
|
@ -1004,10 +1004,10 @@ namespace ts {
|
|||
: node;
|
||||
}
|
||||
|
||||
export function createPropertyAccess(expression: Expression, name: string | Identifier | undefined) {
|
||||
export function createPropertyAccess(expression: Expression, name: string | Identifier) {
|
||||
const node = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression);
|
||||
node.expression = parenthesizeForAccess(expression);
|
||||
node.name = asName(name)!; // TODO: GH#18217
|
||||
node.name = asName(name);
|
||||
setEmitFlags(node, EmitFlags.NoIndentation);
|
||||
return node;
|
||||
}
|
||||
|
@ -2468,7 +2468,7 @@ namespace ts {
|
|||
|
||||
export function createSpreadAssignment(expression: Expression) {
|
||||
const node = <SpreadAssignment>createSynthesizedNode(SyntaxKind.SpreadAssignment);
|
||||
node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined!; // TODO: GH#18217
|
||||
node.expression = parenthesizeExpressionForList(expression);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
@ -1328,6 +1328,8 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
function createMissingNode<T extends Node>(kind: T["kind"], reportAtCurrentPosition: false, diagnosticMessage?: DiagnosticMessage, arg0?: any): T;
|
||||
function createMissingNode<T extends Node>(kind: T["kind"], reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): T;
|
||||
function createMissingNode<T extends Node>(kind: T["kind"], reportAtCurrentPosition: boolean, diagnosticMessage: DiagnosticMessage, arg0?: any): T {
|
||||
if (reportAtCurrentPosition) {
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0);
|
||||
|
@ -4290,7 +4292,7 @@ namespace ts {
|
|||
badNode.end = invalidElement.end;
|
||||
badNode.left = result;
|
||||
badNode.right = invalidElement;
|
||||
badNode.operatorToken = createMissingNode(SyntaxKind.CommaToken, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined!); // TODO: GH#18217
|
||||
badNode.operatorToken = createMissingNode(SyntaxKind.CommaToken, /*reportAtCurrentPosition*/ false);
|
||||
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
|
||||
return <JsxElement><Node>badNode;
|
||||
}
|
||||
|
|
|
@ -1639,7 +1639,7 @@ namespace ts {
|
|||
// arguments are both mapped contiguously to the accessor name.
|
||||
const target = getMutableClone(receiver);
|
||||
setEmitFlags(target, EmitFlags.NoComments | EmitFlags.NoTrailingSourceMap);
|
||||
setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
|
||||
setSourceMapRange(target, firstAccessor.name);
|
||||
|
||||
const propertyName = createExpressionForPropertyName(visitNode(firstAccessor.name, visitor, isPropertyName));
|
||||
setEmitFlags(propertyName, EmitFlags.NoComments | EmitFlags.NoLeadingSourceMap);
|
||||
|
|
|
@ -3856,7 +3856,7 @@ declare namespace ts {
|
|||
function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
|
||||
function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
|
||||
function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
|
||||
function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression;
|
||||
function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
|
||||
function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
|
||||
function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
|
||||
function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
|
||||
|
|
|
@ -3856,7 +3856,7 @@ declare namespace ts {
|
|||
function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
|
||||
function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
|
||||
function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
|
||||
function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression;
|
||||
function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
|
||||
function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
|
||||
function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
|
||||
function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
|
||||
|
|
Loading…
Reference in a new issue