Skip to content

Wrong typing of collectionOp and instanceOp. options args is actually optional #618

Description

@emattias

The options arg is typed to be required here: https://github.com/mike-north/ember-api-actions/blob/master/addon/utils/collection-action.ts#L16C25-L16C37

In the options arg all props are optional except path: https://github.com/mike-north/ember-api-actions/blob/master/addon/utils/collection-action.ts#L7-L14

but path is sent to buildOperationUrl which fallsback to baseUrl when path is not provided: https://github.com/mike-north/ember-api-actions/blob/master/addon/utils/build-url.ts#L61-L63

hence this line

export default function collectionOp<IN = any, OUT = any>(options: CollectionOperationOptions<IN, OUT>) {

should be changed to (just made options optional)

export default function collectionOp<IN = any, OUT = any>(options?: CollectionOperationOptions<IN, OUT>) {

And same thing with instanceOp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions