Closed
Description
As above. Typescript is currently throwing a fit, because...
$set<R extends Model<R>>(propertyKey: string, instances: R|R[], options?: IAssociationActionOptions): Promise<this>;
and this
$set(propertyKey: string, instances: any, options: any): Promise<this> {
are incompatible.
Right now, Typescript is insisting that the third parameter for $set must conform to the interface IAssociationActionOptions, which both conflicts with the implementation and prevents passing save: false
, which is useful when creating multiple associations while disallowing null values.
Example:
const xref = new UsergroupPermissions({
value: PermissionValue.NO
})
await xref.$set('usergroup', usergroup, { save: false })
await xref.$set('permission', permission, { save: false })
await xref.save()
// ...
Resulting Typescript error:
(52, 47) Argument of type '{ save: boolean; }' is not assignable to parameter of type 'IAssociationActionOptions | undefined'.
Metadata
Metadata
Assignees
Labels
No labels