vue-styleguidist icon indicating copy to clipboard operation
vue-styleguidist copied to clipboard

vue-docgen-api: Arrays and objects not detected when TypeScript type assertion is used; arrow function unwrapping breaks

Open catrope opened this issue 3 years ago • 1 comments

Current behavior

If you define a prop as:

foo: {
    type: Array,
    default: () => []
}

then the arrow function is unwrapped, and the default value is returned as [].

But if you define a prop as:

foo: {
    type: Array as PropType<SomeType[]>,
    default: () => []
}

then the arrow function is not unwrapped, and the default value is returned as () => [].

Expected behavior

Arrow functions should be unwrapped even if the type isn't a simple type: Array or type: Object, as long as the underlying type is an array or object (i.e. type: Array as PropType<Something> or type: Object as PropType<Something>).

catrope avatar Jan 05 '22 22:01 catrope

Thank you for reporting this @catrope I will. get on it ASAP

elevatebart avatar Jan 06 '22 15:01 elevatebart