What is the difference between the parameters of the ts function (callback?: () = > void) and (callback?:void)?

function render (callback?: () = > void): string
the parameter of the ts function means that the return value of callback is the return value of the function. The return value of the function is void

The argument to the ts function

function render (callback?:void): string
means that the return value of callback is void

am I right to understand this?

Mar.22,2021

callback?: () = > void, indicates that callback is a function type and does not return a value. It does not mean that the return value is a function. It is written here by ts itself, which not only means the arrow function, but also specifies the parameter type and return value of the function.

callback?:void cannot prove that callback is a function. Ts will think that callback is of type void. You must have reported an error in passing the function.


there's nothing wrong with your understanding. You can actually get a type alias

.
type Callback = () => void;
function render(callback: Callback):string{}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36b04-2c017.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36b04-2c017.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?