Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emattias opened this issue Oct 12, 2023 · 0 comments

Comments

@emattias
Copy link

emattias commented Oct 12, 2023

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

@emattias emattias changed the title Wrong typing of collectionOp. options args is actually optional Wrong typing of collectionOp and instanceOp. options args is actually optional Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant