Skip to content

Commit ae1564a

Browse files
committed
Fix component properpty access bug
1 parent ce6135d commit ae1564a

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ export default () => {
307307
let nodeKind = type.kind;
308308
let component = false;
309309
let flags;
310-
311-
if (nodeKind === ts.SyntaxKind.Identifier) {
312-
if (isComponent(type.text)) {
310+
311+
if (nodeKind === ts.SyntaxKind.Identifier || nodeKind === ts.SyntaxKind.PropertyAccessExpression) {
312+
if (isComponent(type.text || type.expression.text)) {
313313
component = true;
314314
flags = VNodeFlags.ComponentUnknown;
315315
} else {

tests/cases/Component4.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Context.Provider></Context.Provider>

tests/cases/childrenProps11.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Context.Provider children="ab">test</Context.Provider>

tests/references/Component4.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var Inferno = require("inferno");
2+
var createComponentVNode = Inferno.createComponentVNode;
3+
createComponentVNode(2, Context.Provider);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var Inferno = require("inferno");
2+
var createComponentVNode = Inferno.createComponentVNode;
3+
createComponentVNode(2, Context.Provider, { "children": "test" });

0 commit comments

Comments
 (0)