[英]How to map correctly interfaces in typescript
I have a user interface that has an image property. 我有一个具有图像属性的用户界面。 How do I map it correctly? 如何正确映射?
Authenticate 认证
export interface Authenticate {
username: string;
password: string;
}
User 用户
export interface User {
name: string;
surname: string;
image: -- How to map to the image interface below?
}
Image 图片
export interface Image{
alt: string,
org: string,
webImg: string,
thumbnail: string,
description: string,
keywords: any
}
You can use other interfaces as types in interface declarations. 您可以将其他接口用作接口声明中的类型。 So, for example, your User interface could look like: 因此,例如,您的用户界面可能如下所示:
export interface User {
name: string;
surname: string;
image: Image
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.