I'm attempting to extract complex types present within my TypeScript codebase. Utilizing the TypeScript checker, I've been able to successfully extract types; however, I've encountered difficulty when it comes to types nested within arrays.
I've made attempts to address this issue using TypeScript checker functionalities. You can find the current implementation here: Link to the code.
Currently, the code successfully extracts nested types when they are directly associated, as seen in the case of PrettyNestedType. However, it fails to capture nested types when they are within arrays, as demonstrated in the SomethingElse type, which contains an array of PrettyNestedType.
The expected output should resemble the following:
[ 'NestedObjectType', 'SomethingElse', 'PrettyNestedType', 'Imask' ]
but this is only working if i have PrettyNestedType associated without array of items like
type SomethingElse = {
value2: PrettyNestedType;
};
source file
type NestedObjectType = {
value1: string;
value2: number;
value3: Date;
value4: SomethingElse;
};
type SomethingElse = {
value2: PrettyNestedType[];
};
type PrettyNestedType = {
value1: string;
value2: number;
value3: Date;
test: Imask;
};
interface Imask {
hello: string;
}
interface MainObjectType {
value1: string;
value2: number;
value3: Date;
propertyWithTypeAlias: NestedObjectType;
}
there is big question comes into my mind, how to handle union types associated, this is also complex part i think