From b0bc1040593c977b469328724b2704a28eb25f14 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:16:35 -0400 Subject: [PATCH] docs: update typescript.md --- docs/typescript.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/typescript.md b/docs/typescript.md index 6fb469d21..645b88a62 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -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.