kintone / js-sdk

A monorepo for Kintone development tools :wrench:
MIT License
117 stars 54 forks source link

SUBTABLE field requires type and value.id #448

Open the-red opened 4 years ago

the-red commented 4 years ago

I generated type definition of SUBTABLE field. The type and value.id properties are required, which makes them difficult to use.

  Table: {
    type: 'SUBTABLE';
    value: {
      id: string;
      value: {
        text1: kintone.fieldTypes.SingleLineText;
        text2: kintone.fieldTypes.SingleLineText;
      };
    }[];
  };

I wish the type and value.id properties were no longer required.

  Table: {
    type?: 'SUBTABLE';
    value: {
      id?: string;
      value: {
        text1: kintone.fieldTypes.SingleLineText;
        text2: kintone.fieldTypes.SingleLineText;
      };
    }[];
  };
koba04 commented 4 years ago

@the-red Thank you for reporting this! We are going to consider this. Could you describe your use case?

koba04 commented 4 years ago

Changing these types optional also leads the usage inconvenient because it requires to check whether the type exists or not and disables to infer using discriminated unions. If the use case is a type for updating, it seems to be a good option to add another type for it

the-red commented 4 years ago

Sorry for the late response.

As you say, the use case is a type for updating. To add record, I'd like to write as follows. But type error occurs. image

It's hassle to write the following. image

In a similar case, when I put a number in a field of type Number, I got an error. It would be nice if you could prepare different types for the reference and update systems 🚀

    price: kintone.fieldTypes.Number

image image

koba04 commented 4 years ago

@the-red Thank you for your clarification! We'll consider having a solution for this.

koba04 commented 4 years ago

We've merged dts-gen into js-sdk, so this issue has been transferred.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

koba04 commented 3 years ago

not stale

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

the-red commented 3 years ago

not stale

zaki-yama commented 3 years ago

@the-red Thank you! I reopened.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

the-red commented 3 years ago

Not stale

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

the-red commented 3 years ago

Not stale... 🤮

shintaroNagata commented 3 years ago

Ref: https://github.com/kintone/js-sdk/issues/447#issuecomment-937451838