When I declare a function as
const coordinates = (id: number): ([number, number]) => {
the error I get is [ts] Duplicate identifier 'number'.
If I omit type signature for return value, then it infers it as number[]
When I declare a function as
const coordinates = (id: number): ([number, number]) => {
the error I get is [ts] Duplicate identifier 'number'.
If I omit type signature for return value, then it infers it as number[]
const coordinates = (id: number) => [id, id] as const;
// const coordinates: (id: number) => [number, number]
From TypeScript 3.4 onwards you can use const assertations.