Feature(s) impacted
I want to create a smart action to Unpublish a news.
The smart action will set the publishedAt
column of the news
table as NULL
The code used to do this is the following
collection.addAction('Unpublish news', {
scope: 'Single',
execute: async (context, resultBuilder) => {
await context.collection.update(context.filter, {
publishedAt: null,
});
return resultBuilder.success('News unpublished');
},
});
Observed behavior
I get a typescript error on the update “Type ‘null’ is not assignable to type ‘string | undefined’”.
This is because the generated type in the typing.ts
file is “string”
Expected behavior
I want the type generated in the typing file to be Date | null
or at least string | null
Context
- Environment name: local
- Agent (forest package) name & version:
"@forestadmin/agent": "^1.0.0",
and"@forestadmin/datasource-sql": "^1.0.0",
- Database type: postgres