mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 12:32:09 +03:00
[typescript/en] multiple types (#4803)
This commit is contained in:
parent
07b055e8f1
commit
69f7f5d856
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user