Nowadays, I need to update javascript code to typescript.
But I found a question.
Before, I use a lot of arrow functions in before project. Now, I need to add type definition for many of them like after:
(a: number): string => { return `${a}` }
By using many npm packages, the package provide function type like after:
export declare type AAACallback = (a: number) => string
I wanna use the function type to my es6 arrow function.
Maybe you say like this:
let a: AAACallback = a => { return `${a}` }
// then use a
But I don't need to define a at all.
So, do you have any way to use function definition with es6 arrow function without define other variate?
AAACallbackyou assign an arrow function to it. What is the question ? You want to declare the type ofawithout the extra type ?AAACallbackis typescript function type. I wanna use it to define my arrow function.