interface Company {
id: string;
name: string;
}
type input = Company;
// This fails as the types don't match
const ACME: input = { id: '123', name: 'ACME', ceo: 'Eric' };
function mapIds(ids: string[]): input[] {
// This compiles, but it shouldn't, or is Array.map returning something different?
return ids.map(id => ({ id: '1', name: '1', ceo: 'Eric' }));
// This fails as types don't match
return [{ id: '1', name: '2', ceo: 'Eric' }];
}

Given the above code, the typescript compiler will not allow the function to return values that don't belong in the type, however if the return is from an Array.map, it does. You can see this with the above snippet on the Typescript Playground: https://www.typescriptlang.org/play/
Could anyone explain what's up with that?