From 69f7f5d856a1073be6d5adbad811483c4d0ba4f7 Mon Sep 17 00:00:00 2001 From: Albert <87888006+MustCodeAl@users.noreply.github.com> Date: Tue, 14 May 2024 21:34:54 -0500 Subject: [PATCH] [typescript/en] multiple types (#4803) --- typescript.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/typescript.html.markdown b/typescript.html.markdown index f8e78d44..24d1db10 100644 --- a/typescript.html.markdown +++ b/typescript.html.markdown @@ -72,6 +72,11 @@ let f4 = (i: number) => { return i * i; } // keyword needed let f5 = (i: number) => i * i; +// Functions can accept more than one type +function f6(i: string | number): void { + console.log("The value was " + i); +} + // Interfaces are structural, anything that has the properties is compliant with // the interface interface Person {