Skip to content

Commit e6cc1f5

Browse files
committed
changesets
1 parent af43f45 commit e6cc1f5

File tree

5 files changed

+63
-4
lines changed

5 files changed

+63
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"releases": [
3+
{ "name": "extract-react-types", "type": "patch" },
4+
{ "name": "extract-react-types-loader", "type": "patch" },
5+
{ "name": "kind2string", "type": "patch" },
6+
{ "name": "pretty-proptypes", "type": "patch" }
7+
],
8+
"dependents": []
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove dangerous debug code that broke everything

packages/extract-react-types/__snapshots__/test.js.snap

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4970,6 +4970,41 @@ Object {
49704970
}
49714971
`;
49724972

4973+
exports[`typescript React.ComponentType 1`] = `
4974+
Object {
4975+
"component": Object {
4976+
"kind": "generic",
4977+
"name": Object {
4978+
"kind": "id",
4979+
"name": "Component",
4980+
"type": null,
4981+
},
4982+
"value": Object {
4983+
"kind": "object",
4984+
"members": Array [
4985+
Object {
4986+
"key": Object {
4987+
"kind": "id",
4988+
"name": "children",
4989+
},
4990+
"kind": "property",
4991+
"optional": false,
4992+
"value": Object {
4993+
"kind": "generic",
4994+
"value": Object {
4995+
"kind": "id",
4996+
"name": "React.ComponentType",
4997+
},
4998+
},
4999+
},
5000+
],
5001+
"referenceIdName": "Props",
5002+
},
5003+
},
5004+
"kind": "program",
5005+
}
5006+
`;
5007+
49735008
exports[`typescript indexed imported type 1`] = `
49745009
Object {
49755010
"component": Object {

packages/extract-react-types/src/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,9 @@ converters.Identifier = (path, context): K.Id => {
798798
}
799799

800800
if (bindingPath) {
801-
if (name === 'SomethingId')
802-
if (bindingPath.kind === 'module') {
803-
bindingPath = bindingPath.path;
804-
}
801+
if (bindingPath.kind === 'module') {
802+
bindingPath = bindingPath.path;
803+
}
805804

806805
// If path is a descendant of bindingPath and share the same name, this is a recursive type.
807806
if (path.isDescendant(bindingPath) && bindingPath.get('id').node.name === name) {

packages/extract-react-types/test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,21 @@ const TESTS = [
408408
}
409409
`
410410
},
411+
{
412+
name: 'typescript React.ComponentType',
413+
typeSystem: 'typescript',
414+
code: `
415+
import React from 'react';
416+
417+
type Props = {
418+
children: React.ComponentType,
419+
};
420+
421+
class Component extends React.Component<Props> {
422+
423+
}
424+
`
425+
},
411426
{
412427
name: 'ts custom prop',
413428
typeSystem: 'typescript',

0 commit comments

Comments
 (0)