2424
2525// This is the format of the saved JSON files
2626import { Documentation } from 'react-docgen'
27+ import type { Theme } from '@instructure/ui-themes'
2728
2829type ProcessedFile =
2930 Documentation &
@@ -92,99 +93,6 @@ type JSDocFunctionReturns = {
9293 names : string [ ]
9394 }
9495}
95- // TODO these are from React-docgen Documentation.d.ts,
96- // remove when react-docgen exports them
97- interface MethodParameter {
98- name : string ;
99- description ?: string ;
100- optional : boolean ;
101- type ?: TypeDescriptor < FunctionSignatureType > | null ;
102- }
103-
104- interface MethodReturn {
105- description ?: string ;
106- type : TypeDescriptor < FunctionSignatureType > | undefined ;
107- }
108-
109- interface PropDescriptor {
110- type ?: PropTypeDescriptor ;
111- flowType ?: TypeDescriptor < FunctionSignatureType > ;
112- tsType ?: TypeDescriptor < TSFunctionSignatureType > ;
113- required ?: boolean ;
114- defaultValue ?: DefaultValueDescriptor ;
115- description ?: string ;
116- }
117-
118- interface PropTypeDescriptor {
119- name : 'any' | 'array' | 'arrayOf' | 'bool' | 'custom' | 'element' | 'elementType' | 'enum' | 'exact' | 'func' | 'instanceOf' | 'node' | 'number' | 'object' | 'objectOf' | 'shape' | 'string' | 'symbol' | 'union' ;
120- value ?: unknown ;
121- raw ?: string ;
122- computed ?: boolean ;
123- description ?: string ;
124- required ?: boolean ;
125- }
126-
127- type TypeDescriptor < T = FunctionSignatureType > = ElementsType < T > | LiteralType | ObjectSignatureType < T > | SimpleType | T ;
128-
129- interface DefaultValueDescriptor {
130- value : unknown ;
131- computed : boolean ;
132- }
133- interface BaseType {
134- required ?: boolean ;
135- nullable ?: boolean ;
136- alias ?: string ;
137- }
138- interface SimpleType extends BaseType {
139- name : string ;
140- raw ?: string ;
141- }
142- interface LiteralType extends BaseType {
143- name : 'literal' ;
144- value : string ;
145- }
146- interface ElementsType < T = FunctionSignatureType > extends BaseType {
147- name : string ;
148- raw : string ;
149- elements : Array < TypeDescriptor < T > > ;
150- }
151-
152- interface FunctionArgumentType < T > {
153- name : string
154- type ?: TypeDescriptor < T >
155- rest ?: boolean
156- }
157-
158- interface FunctionSignatureType extends BaseType {
159- name : 'signature' ;
160- type : 'function' ;
161- raw : string ;
162- signature : {
163- arguments : Array < FunctionArgumentType < FunctionSignatureType > > ;
164- return ?: TypeDescriptor < FunctionSignatureType > ;
165- } ;
166- }
167- interface TSFunctionSignatureType extends FunctionSignatureType {
168- signature : {
169- arguments : Array < FunctionArgumentType < TSFunctionSignatureType > > ;
170- return ?: TypeDescriptor < TSFunctionSignatureType > ;
171- this ?: TypeDescriptor < TSFunctionSignatureType > ;
172- } ;
173- }
174- interface ObjectSignatureType < T = FunctionSignatureType > extends BaseType {
175- name : 'signature' ;
176- type : 'object' ;
177- raw : string ;
178- signature : {
179- properties : Array < {
180- key : TypeDescriptor < T > | string ;
181- value : TypeDescriptor < T > ;
182- description ?: string ;
183- } > ;
184- constructor ?: TypeDescriptor < T > ;
185- } ;
186- }
187- // end react-docgen part
18896
18997type LibraryOptions = {
19098 name : string
@@ -237,7 +145,7 @@ type MainIconsData = {
237145}
238146
239147type MainDocsData = {
240- themes : Record < string , { resource : any ; requirePath : string } >
148+ themes : Record < string , { resource : Theme ; requirePath : string } >
241149 library : LibraryOptions
242150} & ParsedDoc
243151
@@ -246,16 +154,6 @@ export type {
246154 PackagePathData ,
247155 YamlMetaInfo ,
248156 JSDocFunctionReturns ,
249- PropDescriptor ,
250- MethodParameter ,
251- MethodReturn ,
252- TypeDescriptor ,
253- TSFunctionSignatureType ,
254- SimpleType ,
255- LiteralType ,
256- ElementsType ,
257- ObjectSignatureType ,
258- BaseType ,
259157 LibraryOptions ,
260158 Glyph ,
261159 MainDocsData ,
0 commit comments