Мне нужно привести смешанный тип к формованному массиву в потоке. Tryflow ссылка.
type aShapedArray = Array<{a:string}>;
//externally defined type
const transform = ():mixed => [{a: 'hello'}];
const b = transform();
if (Array.isArray(b)) {
const a: aShapedArray = b;
}
Ошибка
9: const a: aShapedArray = b;
^ array. Has some incompatible type argument with
9: const a: aShapedArray = b;
^ aShapedArray
Type argument `T` is incompatible:
7: const b = transform();
^ mixed. This type is incompatible with
2: type aShapedArray = Array<{a:string}>;
^ object type