You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Parse JSXElement's name as property access instead of just entity name. So when one accesses property of the class through this, checker will check correctly
* wip - just resolve to any type for now
* Resolve string type to anytype and look up property in intrinsicElementsType of Jsx
* Add tests and update baselines
* Remove unneccessary comment
* wip-address PR
* Address PR
* Add tets and update baselines
* Fix linting error
Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+26-2Lines changed: 26 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9657,8 +9657,9 @@ namespace ts {
9657
9657
/**
9658
9658
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
9659
9659
*/
9660
-
function isJsxIntrinsicIdentifier(tagName: Identifier | QualifiedName) {
9661
-
if (tagName.kind === SyntaxKind.QualifiedName) {
9660
+
function isJsxIntrinsicIdentifier(tagName: JsxTagNameExpression) {
9661
+
// TODO (yuisu): comment
9662
+
if (tagName.kind === SyntaxKind.PropertyAccessExpression || tagName.kind === SyntaxKind.ThisKeyword) {
9662
9663
return false;
9663
9664
}
9664
9665
else {
@@ -9854,6 +9855,29 @@ namespace ts {
9854
9855
}));
9855
9856
}
9856
9857
9858
+
// If the elemType is a string type, we have to return anyType to prevent an error downstream as we will try to find construct or call signature of the type
9859
+
if (elemType.flags & TypeFlags.String) {
9860
+
return anyType;
9861
+
}
9862
+
else if (elemType.flags & TypeFlags.StringLiteral) {
9863
+
// If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type
0 commit comments