ts-type-explorer icon indicating copy to clipboard operation
ts-type-explorer copied to clipboard

Explorer errors for class constructors with arrays containing multiple elements

Open mstepin opened this issue 1 year ago • 0 comments

consider this basic code:

type SomeType = {
    prop1: string;
    prop2: string;
}

type SomeOtherType = {
    prop3: string;
    prop4: string;
}
type AnySomeType = SomeType | SomeOtherType

export class SomeClass<T extends AnySomeType> {
    
    constructor([model, customProp]: [T, string]) {
        Object.assign(this, model);
        Object.assign(this, customProp);
    }
}
const yo = new SomeClass<SomeType>([{
    prop1: '',
    prop2: ''
}, 'thisIsCustom'])

Upon inspecting the const yo The explorer errors with "cannot read property of undefined (reading 'name')" image

TS version: 5.2.2 Node version: 18.12.1 VS Code version: 1.92.2 OS: macOS Sonoma 14.6.1 TypeScript Explorer version: v0.4.2

mstepin avatar Sep 05 '24 05:09 mstepin