如何将对象表示为接口



如何将以下javascript对象表示为接口:我确实尝试过使用http://json2ts.com/然而,并没有提供一个干净和动态的界面。因此,我不希望id/代码(即600060016002)出现在接口中。

{
"6000": {
"id": 6000,
"type": "text",
"subType": "tileDynamicSection",
"title": "Title 1",
"description": "Description 1",
"imageUrl": "https://prod.assets.domain.com/uploads/myimage.jpg"
},
"6001": {
"id": 6001,
"type": "text",
"subType": "tileDynamicSection",
"title": "Title 2",
"description": "Description 2",
"imageUrl": "https://prod.assets.domain.com/uploads/myimage.jpg"
},
"6002": {
"id": 6002,
"type": "text",
"subType": "tileDynamicSection",
"title": "Title 3",
"description": "Description 3",
"imageUrl": "https://prod.assets.domain.com/uploads/myimage.jpg"
}
}
export interface Images {
[key: string]: {
id: number;
type: string;
subType: string;
title: string;
description: string;
imageUrl: string;
}
}

相关内容

  • 没有找到相关文章

最新更新