json2ts icon indicating copy to clipboard operation
json2ts copied to clipboard

Missing Optional Operator for Optional Key

Open ZiuChen opened this issue 1 year ago • 0 comments

I have a json below:

{
  name: 'Ziu',
  age: 18,
  friends: [
    { name: 'Kobe', age: 19, isVip: true },
    { name: 'James', age: 20 }
  ]
}

convert it to Typescript Interface using json2ts:

export interface Friend {
        name: string;
        age: number;
        isVip: boolean; // isVip shoult be an Optional Key
}

export interface RootObject {
        name: string;
        age: number;
        friends: Friend[];
}

the optional operator of key isVip is missing

ZiuChen avatar Jul 06 '23 03:07 ZiuChen