Relative Content

Tag Archive for typescriptcallback

Why the first code is working but not the second one?

// Why this is not working function runAfter1s(fn: () => number){     setTimeout(fn, 1000) } const doSomething: () => void = () => {     console.log(‘Hello’)     return 5;   } runAfter1s(doSomething) Why this is working function runAfter1s(fn: () => void){ setTimeout(fn, 1000) > } const doSomething: () => void = () […]