Document ObjectLiteralElementLike (#26024)

This commit is contained in:
Andy 2018-07-27 17:33:42 -07:00 committed by GitHub
parent 57d425169a
commit 644ceab02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 12 deletions

View File

@ -858,6 +858,7 @@ namespace ts {
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
export type ObjectLiteralElementLike
= PropertyAssignment
| ShorthandPropertyAssignment

View File

@ -6632,18 +6632,7 @@ namespace ts {
}
export function isObjectLiteralElement(node: Node): node is ObjectLiteralElement {
switch (node.kind) {
case SyntaxKind.JsxAttribute:
case SyntaxKind.JsxSpreadAttribute:
case SyntaxKind.PropertyAssignment:
case SyntaxKind.ShorthandPropertyAssignment:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return true;
default:
return false;
}
return node.kind === SyntaxKind.JsxAttribute || node.kind === SyntaxKind.JsxSpreadAttribute || isObjectLiteralElementLike(node);
}
/* @internal */

View File

@ -616,6 +616,7 @@ declare namespace ts {
_objectLiteralBrandBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
parent: ObjectLiteralExpression;

View File

@ -616,6 +616,7 @@ declare namespace ts {
_objectLiteralBrandBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
parent: ObjectLiteralExpression;