Frontend engineer – #ui-foundations
1
2
3
Type manipulation
Type affectation
Modern Javascript hidden features
s.dedieu@criteo.com
Frontend engineer – #ui-foundation
s.dedieu@criteo.com
s.dedieu@criteo.com
interface ErrorHandling {
success: boolean;
error?: { message: string };
}
interface ArtworksData {
artworks: { title: string }[];
}
interface ArtistsData {
artists: { name: string }[];
}
// These interfaces are composed to have
// consistent error handling, and their own data.
type ArtworksResponse = ArtworksData & ErrorHandling;
type ArtistsResponse = ArtistsData & ErrorHandling;Example of a Typescript Type intersection