[typescript/en] multiple types (#4803)

This commit is contained in:
Albert 2024-05-14 21:34:54 -05:00 committed by GitHub
parent 07b055e8f1
commit 69f7f5d856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,6 +72,11 @@ let f4 = (i: number) => { return i * i; }
// keyword needed // keyword needed
let f5 = (i: number) => i * i; 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 // Interfaces are structural, anything that has the properties is compliant with
// the interface // the interface
interface Person { interface Person {