Reputation: 377
What does this piece of code mean?
export class App extends Component<Props & { some: string; some2: string; }>
I mean... what is after the & sign
& { some: string; some2: string; }
Upvotes: 0
Views: 68
Reputation: 135
It's an intersection type. When defining interfaces in typescript you can separate each property with a semicolon. You can also use commas. It doesn't matter.
https://www.typescriptlang.org/docs/handbook/interfaces.html
Upvotes: 2
Reputation: 9880
export class App extends Component<Props & { some: string; some2: string; }>
Is no different from
interface SomeInterface {
some: string;
some2: string;
}
export class App extends Component<Props & SomeInterface>
It's just written inline instead of creating a new interface for that one line.
Upvotes: 0