File tree Expand file tree Collapse file tree
boolean-literal-prop copy
interface-props-type-default-alias
interface-props-type-default
interface-props-type-description-tag-alias
interface-props-type-description-tag
interface-props-type-description Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,8 +8,10 @@ import type {
88 BooleanType ,
99 LiteralType ,
1010 NullType ,
11+ NumberType ,
1112 ObjectType ,
1213 PropDescriptor ,
14+ StringType ,
1315 TypeDescriptor ,
1416 UndefinedType ,
1517 UnionType ,
@@ -117,6 +119,18 @@ function parseType(type: Type<ts.Type>): TypeDescriptor {
117119 } as NullType ;
118120 }
119121
122+ if ( type . isString ( ) ) {
123+ return {
124+ name : "string" ,
125+ } as StringType ;
126+ }
127+
128+ if ( type . isNumber ( ) ) {
129+ return {
130+ name : "number" ,
131+ } as NumberType ;
132+ }
133+
120134 if ( type . isObject ( ) || type . isInterface ( ) || type . isAnonymous ( ) ) {
121135 return {
122136 name : "object" ,
Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ export interface BooleanType extends BaseType {
6161 name : "boolean" ;
6262}
6363
64+ export interface NumberType extends BaseType {
65+ name : "number" ;
66+ }
67+
68+ export interface StringType extends BaseType {
69+ name : "string" ;
70+ }
71+
6472export interface ObjectType extends BaseType {
6573 name : "object" ;
6674 properties : Record < string , TypeDescriptor & { required ?: boolean } > ;
@@ -73,7 +81,9 @@ export type TypeDescriptor =
7381 | NullType
7482 | UndefinedType
7583 | BooleanType
76- | ObjectType ;
84+ | ObjectType
85+ | StringType
86+ | NumberType ;
7787
7888export interface PropDescriptor {
7989 type : TypeDescriptor ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44 "props" : {
55 "myProp" : {
66 "type" : {
7- "name" : " unknown" ,
8- "raw" : " string"
7+ "name" : " string"
98 },
109 "required" : true
1110 }
Original file line number Diff line number Diff line change 44 "props" : {
55 "myProp" : {
66 "type" : {
7- "name" : " unknown" ,
8- "raw" : " string"
7+ "name" : " string"
98 },
109 "required" : true ,
1110 "description" : " My prop" ,
Original file line number Diff line number Diff line change 44 "props" : {
55 "myProp" : {
66 "type" : {
7- "name" : " unknown" ,
8- "raw" : " string"
7+ "name" : " string"
98 },
109 "required" : true ,
1110 "description" : " My prop" ,
Original file line number Diff line number Diff line change 44 "props" : {
55 "myProp" : {
66 "type" : {
7- "name" : " unknown" ,
8- "raw" : " string"
7+ "name" : " string"
98 },
109 "required" : true ,
1110 "description" : " My prop description"
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ interface Props {
44 *
55 * @description My prop description
66 */
7- myProp : string ;
7+ myProp : number ;
88}
99
1010export function MyComp ( props : Props ) {
Original file line number Diff line number Diff line change 44 "props" : {
55 "myProp" : {
66 "type" : {
7- "name" : " unknown" ,
8- "raw" : " string"
7+ "name" : " number"
98 },
109 "required" : true ,
1110 "description" : " My prop description"
You can’t perform that action at this time.
0 commit comments