Using a generic type on a TypeScript function:
const func: <T extends number>() => void = () => {
const x: T = 1
}
Emits the following error:
Cannot find name 'T'. TS2304
69 | const func: <T extends number>() => void = () => {
> 70 | const x: T = 1
| ^
71 | }
How can I use generic types inside a function (and not just on its signature)?