Skip to content

Commit

Permalink
docs: update typescript.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamiell committed Nov 19, 2023
1 parent d2425fa commit b0bc104
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,11 @@ setTimeout(() => {
logger("A second has passed!");
}, 1000);
```

Another solution would be to perform a manual type assertion like this:

```ts
setTimeout(logger as (message: string) => void, 1000, "A second has passed!");
```

Obviously, using type assertions makes your code less safe, so use the second solution with care.

0 comments on commit b0bc104

Please sign in to comment.