TypeScript Types
void — ignored function result
Void in a callback return type communicates that the caller should not use the result. A function returning a number may still be assigned to a () => void callback; the runtime return value is not erased. By contrast, a function explicitly annotated with void cannot return an ordinary number expression. Void is not generally identical to undefined. Example output: "number". The example was designed for strict checking with an ES2022 target; type annotations do not add runtime validation.
Formal Syntax & Structure
typescript syntaxtypescript
type Callback = () => void;Working Example
Example Snippettypescript
const notify: () => void = () => 7;console.log(typeof notify());