Closed
Description
TypeScript Version: 3.6.2
Search Terms:
map\array\return type
Code
const fetchCustomVariables = (): { name?: string; type?: string }[] => {
const variableList: { name?: string; type: string }[] = [];
return variableList.map(v => ({ nasme: v.name, type: v.type }));
};
Expected behavior:
Typescript complaints that array of objects generated by map
doesn't match function return type.
Actual behavior:
Typescript doesn't complaint that array of objects generated by map
doesn't match function return type.
Related Issues:
No