Add missing JSXSpreadAttribute case to JSX completion logic (#44514)

This commit is contained in:
Wesley Wigham
2021-06-10 10:01:25 -07:00
committed by GitHub
parent 481c2037cc
commit 130e16d73b
2 changed files with 22 additions and 0 deletions

View File

@@ -1245,6 +1245,7 @@ namespace ts.Completions {
break;
case SyntaxKind.JsxExpression:
case SyntaxKind.JsxSpreadAttribute:
// For `<div foo={true} [||] ></div>`, `parent` will be `{true}` and `previousToken` will be `}`
if (previousToken.kind === SyntaxKind.CloseBraceToken && currentToken.kind === SyntaxKind.GreaterThanToken) {
isJsxIdentifierExpected = true;

View File

@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
//@Filename: file.tsx
////declare var React: any;
////declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: { "aria-whatever"?: string }
//// }
//// interface ElementAttributesProperty { props: any }
////}
////const a = <div {...{}} /*1*/></div>;
verify.completions(
{
marker: "1",
exact: [
{name: "aria-whatever", sortText: completion.SortText.OptionalMember}
]
}
);