expo-type-information 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/bin/cli.js +2 -0
- package/build/cli.d.ts +1 -0
- package/build/cli.js +35 -0
- package/build/cli.js.map +1 -0
- package/build/commands/commandUtils.d.ts +46 -0
- package/build/commands/commandUtils.js +274 -0
- package/build/commands/commandUtils.js.map +1 -0
- package/build/commands/generateJSXIntrinsicsCommand.d.ts +2 -0
- package/build/commands/generateJSXIntrinsicsCommand.js +28 -0
- package/build/commands/generateJSXIntrinsicsCommand.js.map +1 -0
- package/build/commands/generateMocksForFileCommand.d.ts +2 -0
- package/build/commands/generateMocksForFileCommand.js +22 -0
- package/build/commands/generateMocksForFileCommand.js.map +1 -0
- package/build/commands/generateModuleTypesCommand.d.ts +2 -0
- package/build/commands/generateModuleTypesCommand.js +32 -0
- package/build/commands/generateModuleTypesCommand.js.map +1 -0
- package/build/commands/generateViewTypesCommand.d.ts +2 -0
- package/build/commands/generateViewTypesCommand.js +28 -0
- package/build/commands/generateViewTypesCommand.js.map +1 -0
- package/build/commands/inlineModulesInterfaceCommand.d.ts +2 -0
- package/build/commands/inlineModulesInterfaceCommand.js +129 -0
- package/build/commands/inlineModulesInterfaceCommand.js.map +1 -0
- package/build/commands/moduleInterfaceCommand.d.ts +2 -0
- package/build/commands/moduleInterfaceCommand.js +46 -0
- package/build/commands/moduleInterfaceCommand.js.map +1 -0
- package/build/commands/shortModuleInterfaceCommand.d.ts +2 -0
- package/build/commands/shortModuleInterfaceCommand.js +17 -0
- package/build/commands/shortModuleInterfaceCommand.js.map +1 -0
- package/build/commands/typeInformationCommand.d.ts +2 -0
- package/build/commands/typeInformationCommand.js +24 -0
- package/build/commands/typeInformationCommand.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +28 -0
- package/build/index.js.map +1 -0
- package/build/mockgen.d.ts +4 -0
- package/build/mockgen.js +204 -0
- package/build/mockgen.js.map +1 -0
- package/build/swift/sourcekittenTypeInformation.d.ts +6 -0
- package/build/swift/sourcekittenTypeInformation.js +875 -0
- package/build/swift/sourcekittenTypeInformation.js.map +1 -0
- package/build/typeInformation.d.ts +209 -0
- package/build/typeInformation.js +157 -0
- package/build/typeInformation.js.map +1 -0
- package/build/types.d.ts +59 -0
- package/build/types.js +3 -0
- package/build/types.js.map +1 -0
- package/build/typescriptGeneration.d.ts +61 -0
- package/build/typescriptGeneration.js +696 -0
- package/build/typescriptGeneration.js.map +1 -0
- package/build/utils.d.ts +6 -0
- package/build/utils.js +44 -0
- package/build/utils.js.map +1 -0
- package/jest.config.js +6 -0
- package/package.json +46 -5
- package/src/cli.ts +38 -0
- package/src/commands/commandUtils.ts +352 -0
- package/src/commands/generateJSXIntrinsicsCommand.ts +38 -0
- package/src/commands/generateMocksForFileCommand.ts +30 -0
- package/src/commands/generateModuleTypesCommand.ts +39 -0
- package/src/commands/generateViewTypesCommand.ts +39 -0
- package/src/commands/inlineModulesInterfaceCommand.ts +175 -0
- package/src/commands/moduleInterfaceCommand.ts +56 -0
- package/src/commands/shortModuleInterfaceCommand.ts +26 -0
- package/src/commands/typeInformationCommand.ts +35 -0
- package/src/index.ts +9 -0
- package/src/mockgen.ts +338 -0
- package/src/swift/sourcekittenTypeInformation.ts +1173 -0
- package/src/typeInformation.ts +326 -0
- package/src/types.ts +68 -0
- package/src/typescriptGeneration.ts +1179 -0
- package/src/utils.ts +44 -0
- package/tests/TestModule.swift +175 -0
- package/tests/__snapshots__/typeInformation.test.ts.snap +1578 -0
- package/tests/typeInformation.test.ts +134 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as os from 'os';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getSwiftFileTypeInformation,
|
|
7
|
+
preprocessSwiftFile,
|
|
8
|
+
} from './swift/sourcekittenTypeInformation';
|
|
9
|
+
import { taskAll } from './utils';
|
|
10
|
+
|
|
11
|
+
export enum IdentifierKind {
|
|
12
|
+
BASIC,
|
|
13
|
+
ENUM,
|
|
14
|
+
RECORD,
|
|
15
|
+
CLASS,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type ParametrizedType = {
|
|
19
|
+
name: TypeIdentifier;
|
|
20
|
+
types: Type[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type Argument = { name: string | undefined; type: Type };
|
|
24
|
+
export type Field = Argument;
|
|
25
|
+
|
|
26
|
+
export type RecordType = {
|
|
27
|
+
name: string;
|
|
28
|
+
fields: Field[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type EnumCase = string;
|
|
32
|
+
|
|
33
|
+
export type EnumType = {
|
|
34
|
+
name: string;
|
|
35
|
+
cases: EnumCase[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type SumType = {
|
|
39
|
+
types: Type[];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type DictionaryType = {
|
|
43
|
+
key: Type;
|
|
44
|
+
value: Type;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type OptionalType = Type;
|
|
48
|
+
export type ArrayType = Type;
|
|
49
|
+
export type TypeIdentifier = string;
|
|
50
|
+
export type AnonymousType = ParametrizedType | SumType | OptionalType | DictionaryType | ArrayType;
|
|
51
|
+
|
|
52
|
+
export enum TypeKind {
|
|
53
|
+
BASIC,
|
|
54
|
+
IDENTIFIER,
|
|
55
|
+
SUM,
|
|
56
|
+
PARAMETRIZED,
|
|
57
|
+
OPTIONAL,
|
|
58
|
+
ARRAY,
|
|
59
|
+
DICTIONARY,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export enum BasicType {
|
|
63
|
+
ANY,
|
|
64
|
+
STRING,
|
|
65
|
+
NUMBER,
|
|
66
|
+
BOOLEAN,
|
|
67
|
+
VOID,
|
|
68
|
+
UNDEFINED,
|
|
69
|
+
UNRESOLVED,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type Type = {
|
|
73
|
+
kind: TypeKind;
|
|
74
|
+
type: BasicType | TypeIdentifier | AnonymousType;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type PropertyDeclaration = ConstantDeclaration;
|
|
78
|
+
export type ViewDeclaration = ModuleClassDeclaration;
|
|
79
|
+
export type EventDeclaration = string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Retain information of where the thing was defined in the file.
|
|
83
|
+
* As collecting type information is written in asynchronous way it is non-deterministic.
|
|
84
|
+
* To make it deterministic we just sort the declaration by the definitionOffset, maintianing the same ordering as in original file.
|
|
85
|
+
*/
|
|
86
|
+
export type DefinitionOffset = {
|
|
87
|
+
definitionOffset: number;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type ConstantDeclaration = {
|
|
91
|
+
name: string;
|
|
92
|
+
type: Type;
|
|
93
|
+
} & DefinitionOffset;
|
|
94
|
+
|
|
95
|
+
export type FunctionDeclaration = {
|
|
96
|
+
name: string;
|
|
97
|
+
returnType: Type;
|
|
98
|
+
arguments: Argument[];
|
|
99
|
+
parameters: Type[];
|
|
100
|
+
} & DefinitionOffset;
|
|
101
|
+
|
|
102
|
+
export type PropDeclaration = {
|
|
103
|
+
name: string;
|
|
104
|
+
arguments: Argument[];
|
|
105
|
+
} & DefinitionOffset;
|
|
106
|
+
|
|
107
|
+
export type ConstructorDeclaration = {
|
|
108
|
+
arguments: Argument[];
|
|
109
|
+
} & DefinitionOffset;
|
|
110
|
+
|
|
111
|
+
export type ClassDeclaration = {
|
|
112
|
+
name: string;
|
|
113
|
+
constructor: ConstructorDeclaration | null;
|
|
114
|
+
methods: FunctionDeclaration[];
|
|
115
|
+
asyncMethods: FunctionDeclaration[];
|
|
116
|
+
properties: PropertyDeclaration[];
|
|
117
|
+
} & DefinitionOffset;
|
|
118
|
+
|
|
119
|
+
export type ModuleClassDeclaration = {
|
|
120
|
+
name: string;
|
|
121
|
+
constructor: ConstructorDeclaration | null;
|
|
122
|
+
constants: ConstantDeclaration[];
|
|
123
|
+
classes: ClassDeclaration[];
|
|
124
|
+
functions: FunctionDeclaration[];
|
|
125
|
+
asyncFunctions: FunctionDeclaration[];
|
|
126
|
+
properties: PropertyDeclaration[];
|
|
127
|
+
props: PropDeclaration[];
|
|
128
|
+
views: ViewDeclaration[];
|
|
129
|
+
events: EventDeclaration[];
|
|
130
|
+
} & DefinitionOffset;
|
|
131
|
+
|
|
132
|
+
export type IdentifierDefinition = {
|
|
133
|
+
kind: IdentifierKind;
|
|
134
|
+
definition: string | RecordType | EnumType | ClassDeclaration;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type TypeIdentifierDefinitionMap = Map<string, IdentifierDefinition>;
|
|
138
|
+
|
|
139
|
+
export type TypeIdentifierDefinitionList = [string, IdentifierDefinition][];
|
|
140
|
+
|
|
141
|
+
export type FileTypeInformationSerialized = {
|
|
142
|
+
usedTypeIdentifiersList: string[];
|
|
143
|
+
declaredTypeIdentifiersList: string[];
|
|
144
|
+
inferredTypeParametersCountList: [string, number][];
|
|
145
|
+
typeIdentifierDefinitionList: TypeIdentifierDefinitionList;
|
|
146
|
+
moduleClasses: ModuleClassDeclaration[];
|
|
147
|
+
records: RecordType[];
|
|
148
|
+
enums: EnumType[];
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* FileTypeInformation object abstracts over type related information in a file.
|
|
153
|
+
* The abstraction is closely related to Typescript and expo NativeModules (both to be independent of the actual native side
|
|
154
|
+
* and to give accurate information about what and how we can use the given module).
|
|
155
|
+
*/
|
|
156
|
+
export type FileTypeInformation = {
|
|
157
|
+
/**
|
|
158
|
+
* @field Set of all type identifiers declared and used in the file.
|
|
159
|
+
*/
|
|
160
|
+
usedTypeIdentifiers: Set<string>;
|
|
161
|
+
/**
|
|
162
|
+
* @field Set of all type identifiers declared in the file.
|
|
163
|
+
*/
|
|
164
|
+
declaredTypeIdentifiers: Set<string>;
|
|
165
|
+
/**
|
|
166
|
+
* @field For parametrized types it is the maximum number of parameters this type is used with.
|
|
167
|
+
* This map is useful if we want to infer how many parameters a type declared in other file has.
|
|
168
|
+
*
|
|
169
|
+
* For example if `Set<string>` exists in a file then inferredTypeParametersCount['Set'] == 1.
|
|
170
|
+
* If `Map<number, string>` exists then inferredTypeParametersCount['Map'] == 2.
|
|
171
|
+
* If you use both `SomeParametrizedType<Type1, Type2>` and `SomeParametrizedType<Type3>` then inferredTypeParametersCount['SomeParametrizedType'] == 2.
|
|
172
|
+
*/
|
|
173
|
+
inferredTypeParametersCount: Map<string, number>;
|
|
174
|
+
/**
|
|
175
|
+
* @field Maps string identifier to the appropriate declaration object. For now only enum and records identifiers are mapped.
|
|
176
|
+
*/
|
|
177
|
+
typeIdentifierDefinitionMap: TypeIdentifierDefinitionMap;
|
|
178
|
+
/**
|
|
179
|
+
* @field Array of all module classes declared in the given file.
|
|
180
|
+
*/
|
|
181
|
+
moduleClasses: ModuleClassDeclaration[];
|
|
182
|
+
/**
|
|
183
|
+
* @field Array of all record classes declared in the given file.
|
|
184
|
+
*/
|
|
185
|
+
records: RecordType[];
|
|
186
|
+
/**
|
|
187
|
+
* @field Array of all enums declared in the given file.
|
|
188
|
+
*/
|
|
189
|
+
enums: EnumType[];
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Used for testing purposes, maps Sets and Maps to Arrays and returns FileTypeInformationSerialized object which can be written to a JSON.
|
|
194
|
+
* @param param0 FileTypeInformation object to serialize.
|
|
195
|
+
* @returns FileTypeInformationSerialized object.
|
|
196
|
+
*/
|
|
197
|
+
export function serializeTypeInformation({
|
|
198
|
+
usedTypeIdentifiers,
|
|
199
|
+
declaredTypeIdentifiers,
|
|
200
|
+
inferredTypeParametersCount,
|
|
201
|
+
typeIdentifierDefinitionMap,
|
|
202
|
+
moduleClasses,
|
|
203
|
+
records,
|
|
204
|
+
enums,
|
|
205
|
+
}: FileTypeInformation): FileTypeInformationSerialized {
|
|
206
|
+
return {
|
|
207
|
+
usedTypeIdentifiersList: [...usedTypeIdentifiers.keys()].sort(),
|
|
208
|
+
declaredTypeIdentifiersList: [...declaredTypeIdentifiers.keys()].sort(),
|
|
209
|
+
inferredTypeParametersCountList: [...inferredTypeParametersCount.entries()].sort(),
|
|
210
|
+
typeIdentifierDefinitionList: [...typeIdentifierDefinitionMap.entries()].sort(),
|
|
211
|
+
moduleClasses,
|
|
212
|
+
records,
|
|
213
|
+
enums,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Used for testing purposes, maps Arrays to Sets and Maps depending on the field and returns FileTypeInformation object.
|
|
219
|
+
* @param param0 FileTypeInformationSerialized object to deserialize.
|
|
220
|
+
* @returns FileTypeInformation object.
|
|
221
|
+
*/
|
|
222
|
+
export function deserializeTypeInformation({
|
|
223
|
+
usedTypeIdentifiersList,
|
|
224
|
+
declaredTypeIdentifiersList,
|
|
225
|
+
inferredTypeParametersCountList,
|
|
226
|
+
typeIdentifierDefinitionList,
|
|
227
|
+
moduleClasses,
|
|
228
|
+
records,
|
|
229
|
+
enums,
|
|
230
|
+
}: FileTypeInformationSerialized): FileTypeInformation {
|
|
231
|
+
return {
|
|
232
|
+
usedTypeIdentifiers: new Set<string>(usedTypeIdentifiersList),
|
|
233
|
+
declaredTypeIdentifiers: new Set<string>(declaredTypeIdentifiersList),
|
|
234
|
+
inferredTypeParametersCount: new Map<string, number>(inferredTypeParametersCountList),
|
|
235
|
+
typeIdentifierDefinitionMap: new Map(typeIdentifierDefinitionList),
|
|
236
|
+
moduleClasses,
|
|
237
|
+
records,
|
|
238
|
+
enums,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Defines the level of type inference to apply when extracting type information.
|
|
244
|
+
* Note: In case where type inference is on, it may take more then twice the time to compute the type information.
|
|
245
|
+
*/
|
|
246
|
+
export enum TypeInferenceOption {
|
|
247
|
+
/** No type inference will be performed. */
|
|
248
|
+
NO_INFERENCE,
|
|
249
|
+
/** Basic type inference will be applied. */
|
|
250
|
+
SIMPLE_INFERENCE,
|
|
251
|
+
/** Preprocesses the file by injecting returns to extract more type info from sourcekitten. */
|
|
252
|
+
PREPROCESS_AND_INFERENCE,
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export type StringInputOption = {
|
|
256
|
+
type: 'string';
|
|
257
|
+
fileContent: string;
|
|
258
|
+
language: 'Swift';
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export type FileInputOption = {
|
|
262
|
+
type: 'file';
|
|
263
|
+
inputFileAbsolutePaths: string[];
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Options specifying the input source and inference level for retrieving type information.
|
|
268
|
+
*/
|
|
269
|
+
export type GetFileTypeInformationOptions = {
|
|
270
|
+
/** The input source, provided either as a direct string or a file path. */
|
|
271
|
+
input: StringInputOption | FileInputOption;
|
|
272
|
+
/** The desired level of type inference. Defaults to PREPROCESS_AND_INFERENCE if omitted. */
|
|
273
|
+
typeInference?: TypeInferenceOption;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
async function mergeFileContents(absoluteFilePaths: string[]): Promise<string> {
|
|
277
|
+
const filesContents = await taskAll(absoluteFilePaths, (filePath) =>
|
|
278
|
+
fs.promises.readFile(filePath, 'utf-8')
|
|
279
|
+
);
|
|
280
|
+
return filesContents.join('');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async function withTempFile<T>(content: string, fn: (filePath: string) => Promise<T>): Promise<T> {
|
|
284
|
+
const tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'type-gen-'));
|
|
285
|
+
const filePath = path.join(tempDir, 'TypeInformationTemporaryFile.swift');
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
await fs.promises.writeFile(filePath, content, 'utf8');
|
|
289
|
+
return await fn(filePath);
|
|
290
|
+
} finally {
|
|
291
|
+
await fs.promises.rm(tempDir, { recursive: true, force: true });
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Reads and extracts `FileTypeInformation` from either a provided file path or a raw string of source code.
|
|
297
|
+
* If a raw string is provided, or if the `PREPROCESS_AND_INFERENCE` inference option is selected,
|
|
298
|
+
* the function will create a temporary file with the (optionally preprocessed) content to facilitate parsing.
|
|
299
|
+
* @param options - Configuration object containing the input source (file or string) and the desired level of type inference.
|
|
300
|
+
* @returns A promise that resolves to a `FileTypeInformation` object if the input was parsed successfully. Otherwise, it returns `null`.
|
|
301
|
+
*/
|
|
302
|
+
export async function getFileTypeInformation({
|
|
303
|
+
input,
|
|
304
|
+
typeInference,
|
|
305
|
+
}: GetFileTypeInformationOptions): Promise<FileTypeInformation | null> {
|
|
306
|
+
const shouldPreprocessFile = typeInference === TypeInferenceOption.PREPROCESS_AND_INFERENCE;
|
|
307
|
+
const typeInferenceOn = typeInference !== TypeInferenceOption.NO_INFERENCE;
|
|
308
|
+
if (!shouldPreprocessFile && input.type === 'file' && input.inputFileAbsolutePaths.length === 0) {
|
|
309
|
+
return getSwiftFileTypeInformation(input.inputFileAbsolutePaths[0] as string, {
|
|
310
|
+
typeInference: typeInferenceOn,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const fileContent =
|
|
315
|
+
input.type === 'file'
|
|
316
|
+
? await mergeFileContents(input.inputFileAbsolutePaths)
|
|
317
|
+
: input.fileContent;
|
|
318
|
+
|
|
319
|
+
const preprocessedContent = shouldPreprocessFile ? preprocessSwiftFile(fileContent) : fileContent;
|
|
320
|
+
|
|
321
|
+
return withTempFile(preprocessedContent, async (tempFilePath) => {
|
|
322
|
+
return getSwiftFileTypeInformation(tempFilePath, {
|
|
323
|
+
typeInference: typeInferenceOn,
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type FileType = {
|
|
2
|
+
path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type Attribute = {
|
|
7
|
+
'key.attribute': string;
|
|
8
|
+
'key.length': number;
|
|
9
|
+
'key.offset': number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type Structure = {
|
|
13
|
+
'key.substructure': Structure[];
|
|
14
|
+
'key.typename': string;
|
|
15
|
+
'key.name': string;
|
|
16
|
+
'key.kind': string;
|
|
17
|
+
'key.offset': number;
|
|
18
|
+
'key.length': number;
|
|
19
|
+
'key.nameoffset': number;
|
|
20
|
+
'key.inheritedtypes': { 'key.name': string }[];
|
|
21
|
+
'key.attributes': Attribute[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type CursorInfoOutput = {
|
|
25
|
+
'key.fully_annotated_decl': string;
|
|
26
|
+
'key.annotated_decl': string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type FullyAnnotatedDecl = {
|
|
30
|
+
'decl.function.free': {
|
|
31
|
+
'decl.var.parameter': {
|
|
32
|
+
'decl.var.parameter.argument_label': string;
|
|
33
|
+
'decl.var.parameter.type': string;
|
|
34
|
+
}[];
|
|
35
|
+
'decl.function.returntype': string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type ClosureTypes = {
|
|
40
|
+
parameters: {
|
|
41
|
+
name: any;
|
|
42
|
+
typename: any;
|
|
43
|
+
}[];
|
|
44
|
+
returnType: any;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type Closure = {
|
|
48
|
+
name: string;
|
|
49
|
+
types: ClosureTypes | null;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type Prop = {
|
|
53
|
+
name: string;
|
|
54
|
+
types: Omit<ClosureTypes, 'returnType'>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type OutputModuleDefinition = {
|
|
58
|
+
name: string;
|
|
59
|
+
views: OutputNestedClassDefinition[];
|
|
60
|
+
classes: OutputNestedClassDefinition[];
|
|
61
|
+
events: {
|
|
62
|
+
name: string;
|
|
63
|
+
}[];
|
|
64
|
+
} & Record<'asyncFunctions' | 'functions' | 'properties', Closure[]> &
|
|
65
|
+
Record<'props', Prop[]>;
|
|
66
|
+
|
|
67
|
+
// views and classes are a very similar structure, same as module but without more nesting levels
|
|
68
|
+
export type OutputNestedClassDefinition = Omit<OutputModuleDefinition, 'views' | 'classes'>;
|