kintone/js-sdk

The type of lookup does not exist in fieldTypes

kosuke-k opened this issue · 4 comments

Versions

  • @kintone/dts-gen 6.1.16

Current Behavior

The type of lookup does not exist in fieldTypes.
Currently, specifying a lookup property for a lookup field results in a type error.

https://github.com/kintone/js-sdk/blob/master/packages/dts-gen/kintone.d.ts#L227

Expected Behavior

We want to specify the lookup property like this.

record[fieldCode].lookup = 'CLEAR';
record[fieldCode].lookup = true;

@kosuke-k

Thank you for your reporting.
We are checking this issue and will reply to you soon.

@kosuke-k

We checked your issue and would like to reply to you as below:

Currently, dts-gen does not fully cover the record obtained from kintone.events.on handler, nor supports rest-api-client yet.
We are going to consider overall improvements to TypeScript type provision in the future (including your case).
Until then, we would like you to do some workarounds.

For example: define your own types

type LookupText = kintone.fieldTypes.SingleLineText & {lookup: string | boolean};
type LookupNumber = kintone.fieldTypes.Number & {lookup: string | boolean};

Thank you for your patience and understanding.

@hung-cybo
Thanks for your reply and suggested workaround.
I understand that it is not yet supported.

I hope this will be improved in the future.

@kosuke-k

Thank you for your understanding.
I will close this issue.
If you still have any concerns, please post a new issue.
Have a nice day.