mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Move isObjectLiteralElement to public utilities (#20605)
This commit is contained in:
@@ -5847,4 +5847,19 @@ namespace ts {
|
||||
export function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer {
|
||||
return hasInitializer(node) && !isForStatement(node) && !isForInStatement(node) && !isForOfStatement(node) && !isJsxAttribute(node);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2251,20 +2251,6 @@ namespace ts {
|
||||
isLiteralComputedPropertyDeclarationName(node);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 }
|
||||
*/
|
||||
|
||||
@@ -3104,6 +3104,7 @@ declare namespace ts {
|
||||
function isJSDocCommentContainingNode(node: Node): boolean;
|
||||
function isSetAccessor(node: Node): node is SetAccessorDeclaration;
|
||||
function isGetAccessor(node: Node): node is GetAccessorDeclaration;
|
||||
function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
|
||||
}
|
||||
declare namespace ts {
|
||||
type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
|
||||
|
||||
@@ -3157,6 +3157,7 @@ declare namespace ts {
|
||||
function isJSDocCommentContainingNode(node: Node): boolean;
|
||||
function isSetAccessor(node: Node): node is SetAccessorDeclaration;
|
||||
function isGetAccessor(node: Node): node is GetAccessorDeclaration;
|
||||
function isObjectLiteralElement(node: Node): node is ObjectLiteralElement;
|
||||
}
|
||||
declare namespace ts {
|
||||
function createNode(kind: SyntaxKind, pos?: number, end?: number): Node;
|
||||
|
||||
Reference in New Issue
Block a user