Forest Typescript: IDE complains about the load hook

Expected behavior

{
    name: 'Add Collection',
    type: 'single',
    fields: [
        {
            field: 'Tracking',
            type: 'Enum',
            enums: [],
            description:
                'Tracking for normal collections.',
            isRequired: true
        }
    ],
    hooks: {
        load: async ({ fields, request }) => {
                    const id = parseInt(request.body.data.attributes.ids[0]);
                    const descriptions = repo.findAll(id);
                    trackingField.enums = descriptions;
                    return fields;
                }
        }
    }

In the above piece of code, visual studio code gives the error:

Type '({ fields, request }: { fields: SmartActionLoadHookField[]; request: SmartActionLoadHookRequest; }) => Promise<SmartActionLoadHookField[]>' is not assignable to type 'SmartActionLoadHook'.
  Type 'Promise<SmartActionLoadHookField[]>' is missing the following properties from type 'SmartActionLoadHookField[]': length, pop, push, concat, and 26 more.ts(2322)
(property) SmartActionHooks.load: Liana.SmartActionLoadHook

I would expect no error as the code itself works fine. Seems to be a typing issue

Actual behavior

IDE finds errors in functional code.

Context

Please provide any relevant information about your setup.

  • Package Version: “forest-express-sequelize”: “^8.0.6”
  • Express Version: “express”: “^4.17.1”
  • Sequelize Version: “sequelize”: “6.6.2”
  • Database Dialect: postgres

Side note

As a side note, why does the forest interface for a smart action field not have a widget as a property?

Hi @SoftwareBridgementKe :wave: welcome to our community. Thank for your feedback, this is indeed an issue. I will open a bug report and we reach you here when the issue are fixed.

1 Like

Hi @Arnaud_Moncel, is there any update on this issue?

Hi @SoftwareBridgementKe :wave: we released a fix on forest-express-sequelize yesterday you can update the package to version 8.3.2 and let me know if it work properly :pray:

1 Like

Hi,
Yes this fixed my issue, thank you.
However, I am noticing a new issue after upgrading to the latest release, will create a seperate topic for that.
Nevermind, all is good.

1 Like