【发布时间】:2021-05-24 10:02:54
【问题描述】:
{
"title" : "Samsung Galaxy S10",
"tags" : {
"android" : true,
"samsung" : true
}
}
我正在使用 Typescript 对 JSON 输出进行建模,如下所示。
export interface PostModel {
title: string;
tags: Tags;
}
export interface Tags {
android: boolean;
samsung: boolean;
}
如何在添加标签时制作唯一的“键、值”模型?目前我无法发送除 android 和 samsung 以外的密钥。
【问题讨论】:
标签: javascript json typescript react-typescript