Reputation: 405
In the following code:
foo(first: string, second: string) {
// ..
}
Do I have to write string twice, or could I tell Typescript that; "hey, both of these parameters are of the same type".
Upvotes: 0
Views: 158
Reputation: 66500
Yes, you have to declare the type of each parameter as the first
and second
parameter have nothing in common. You must declare their type explicitly.
Upvotes: 1