File tree Expand file tree Collapse file tree 6 files changed +73
-0
lines changed
.changeset/late-badgers-poke Expand file tree Collapse file tree 6 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "releases" : [{ "name" : " extract-react-types" , "type" : " minor" }],
3
+ "dependents" : [
4
+ {
5
+ "name" : " babel-plugin-extract-react-types" ,
6
+ "type" : " patch" ,
7
+ "dependencies" : [" extract-react-types" ]
8
+ },
9
+ {
10
+ "name" : " extract-react-types-loader" ,
11
+ "type" : " patch" ,
12
+ "dependencies" : [" extract-react-types" ]
13
+ },
14
+ { "name" : " kind2string" , "type" : " patch" , "dependencies" : [" extract-react-types" ] },
15
+ {
16
+ "name" : " pretty-proptypes" ,
17
+ "type" : " patch" ,
18
+ "dependencies" : [" kind2string" , " extract-react-types" ]
19
+ }
20
+ ]
21
+ }
Original file line number Diff line number Diff line change
1
+ Adds support for the TSUnknownKeyword
Original file line number Diff line number Diff line change @@ -4956,6 +4956,37 @@ Object {
4956
4956
}
4957
4957
` ;
4958
4958
4959
+ exports [` ts unknown prop 1` ] = `
4960
+ Object {
4961
+ " component" : Object {
4962
+ " kind" : " generic" ,
4963
+ " name" : Object {
4964
+ " kind" : " id" ,
4965
+ " name" : " Component" ,
4966
+ " type" : null ,
4967
+ },
4968
+ " value" : Object {
4969
+ " kind" : " object" ,
4970
+ " members" : Array [
4971
+ Object {
4972
+ " key" : Object {
4973
+ " kind" : " id" ,
4974
+ " name" : " children" ,
4975
+ },
4976
+ " kind" : " property" ,
4977
+ " optional" : false ,
4978
+ " value" : Object {
4979
+ " kind" : " unknown" ,
4980
+ },
4981
+ },
4982
+ ],
4983
+ " referenceIdName" : " Props" ,
4984
+ },
4985
+ },
4986
+ " kind" : " program" ,
4987
+ }
4988
+ ` ;
4989
+
4959
4990
exports [` ts void 1` ] = `
4960
4991
Object {
4961
4992
" component" : Object {
Original file line number Diff line number Diff line change @@ -1193,6 +1193,11 @@ converters.TSNullKeyword = (path, context): K.Null => {
1193
1193
return { kind : 'null' } ;
1194
1194
} ;
1195
1195
1196
+ /* eslint-disable-next-line no-unused-vars */
1197
+ converters . TSUnknownKeyword = ( path , context ) : K . Unknown => {
1198
+ return { kind : 'unknown' } ;
1199
+ } ;
1200
+
1196
1201
/* eslint-disable-next-line no-unused-vars */
1197
1202
converters . TSThisType = ( path , context ) : K . This => {
1198
1203
return { kind : 'custom' , value : 'this' } ;
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ export type Number = {
104
104
value ?: number
105
105
} ;
106
106
export type Null = { kind : 'null' } ;
107
+ export type Unknown = { kind : 'unknown' } ;
107
108
export type TemplateElement = {
108
109
kind : 'templateElement' ,
109
110
value : { raw : string , cooked : string }
Original file line number Diff line number Diff line change @@ -1665,6 +1665,20 @@ const TESTS = [
1665
1665
class Component extends React.Component<Foo<string, {}>> {
1666
1666
}
1667
1667
`
1668
+ } ,
1669
+ {
1670
+ name : 'ts unknown prop' ,
1671
+ typeSystem : 'typescript' ,
1672
+ code : `
1673
+ import React from 'react';
1674
+
1675
+ type Props = {
1676
+ children: unknown,
1677
+ };
1678
+
1679
+ class Component extends React.Component<Props> {
1680
+ }
1681
+ `
1668
1682
}
1669
1683
] ;
1670
1684
You can’t perform that action at this time.
0 commit comments