When attempting to utilize a generic type within a TypeScript function:
const func: <T extends number>() => void = () => {
const x: T = 1
}
An error message is generated:
Cannot find name 'T'. TS2304
69 | const func: <T extends number>() => void = () => {
> 70 | const x: T = 1
| ^
71 | }
Is there a way to effectively utilize generic types within a function instead of solely within its signature?