TypeScript Version: 3.6.2
Search Terms:
map\array\return type
Code
constfetchCustomVariables=(): {name?: string;type?: string}[]=>{constvariableList: {name?: string;type: string}[]=[];returnvariableList.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.
Playground Link:
http://www.typescriptlang.org/play/#code/PTAEGUAsHsFcBsAmoDG0C2AHeBDAlgHYBQaBAzgC6gBmAphSpAMKyUYBqOATnjgEbxaZUAF5QACgCUALlABvUARzpaAflmUeBAOYBuUBQCemNRopbtoAL4BtALqiAfPKKg3qaOSoA3brwG0ADJ4lLIKSirqoJqEegbGtGYW1vaioPa6ru5c9LBcBKC+PPyCwZQAdOg4mOLeThLhOGQqst7lEbQANPEmreVGJtaSkplWmUQgoACCwpC0OSSelDT0jCxs6JzFAWQATGlSYYrKptHmsfoDpzE61vVyWW6ky0X+pSEURx1RN3FXSbEUg4xBlHqAchQ8gVGs1EqAAOQARnh3X+CN28LGRCxQA
Related Issues:
No
TypeScript Version: 3.6.2
Search Terms:
map\array\return type
Code
Expected behavior:
Typescript complaints that array of objects generated by
mapdoesn't match function return type.Actual behavior:
Typescript doesn't complaint that array of objects generated by
mapdoesn't match function return type.Playground Link:
http://www.typescriptlang.org/play/#code/PTAEGUAsHsFcBsAmoDG0C2AHeBDAlgHYBQaBAzgC6gBmAphSpAMKyUYBqOATnjgEbxaZUAF5QACgCUALlABvUARzpaAflmUeBAOYBuUBQCemNRopbtoAL4BtALqiAfPKKg3qaOSoA3brwG0ADJ4lLIKSirqoJqEegbGtGYW1vaioPa6ru5c9LBcBKC+PPyCwZQAdOg4mOLeThLhOGQqst7lEbQANPEmreVGJtaSkplWmUQgoACCwpC0OSSelDT0jCxs6JzFAWQATGlSYYrKptHmsfoDpzE61vVyWW6ky0X+pSEURx1RN3FXSbEUg4xBlHqAchQ8gVGs1EqAAOQARnh3X+CN28LGRCxQA
Related Issues:
No