Sometimes, we want to add multiple type signatures for members or union types in TypeScript.
In this article, we’ll look at how to add multiple type signatures for members or union types in TypeScript.
How to add multiple type signatures for members or union types in TypeScript?
To add multiple type signatures for members or union types in TypeScript, we can add union types with TypeScript.
For instance, we write
interface Foo {
bar: string | boolean;
}
to set the bar
property to be either a string or boolean with string | boolean
.
Conclusion
To add multiple type signatures for members or union types in TypeScript, we can add union types with TypeScript.