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

[BUG] SELECT.from().bind() is not accepted #391

Open
1 task done
softproviding-brodmd opened this issue Jan 9, 2025 · 1 comment
Open
1 task done

[BUG] SELECT.from().bind() is not accepted #391

softproviding-brodmd opened this issue Jan 9, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@softproviding-brodmd
Copy link

softproviding-brodmd commented Jan 9, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

when using

let srv = new cds.Service
await SELECT.from(Books).bind(srv)

from the capire documentation:
https://cap.cloud.sap/docs/node.js/cds-ql#bind-srv

the following error occurs:
Property 'bind' does not exist on type 'Awaitable<SELECT_3<PluralInstanceType<typeof Books>>, PluralInstanceType<typeof Books>>'.ts(2339)

but the method 'bind()' does exists and the code is working as exepcted.

Please don't get me wrong, this is no something severe, I just wanted to mention it so you know about it.

Expected Behavior

No type error

References

https://cap.cloud.sap/docs/node.js/cds-ql#bind-srv

Versions

@cap-js/asyncapi: 1.0.2
@cap-js/cds-typer: 0.31.0
@cap-js/cds-types: 0.7.0
@cap-js/db-service: 1.15.1
@cap-js/openapi: 1.1.1
@cap-js/sqlite: 1.7.7
@sap/cds: 8.6.0
@sap/cds-compiler: 5.4.4
@sap/cds-dk: 8.6.1
@sap/cds-dk (global): 8.6.1
@sap/cds-fiori: 1.2.7
@sap/cds-foss: 5.0.1
@sap/cds-hana: 2.0.0
@sap/cds-mtxs: 2.4.2
@sap/eslint-plugin-cds: 3.1.2
Node.js: v20.18.1

Anything else? Logs?

No response

@softproviding-brodmd softproviding-brodmd added the bug Something isn't working label Jan 9, 2025
@daogrady
Copy link
Contributor

daogrady commented Jan 9, 2025

Hi David,

thanks for bringing this to our attention. I believe this is just a case of missing parentheses. The following should probably work:

;(await SELECT.from(Books)).bind(srv)

EDIT: misread the docs. This seems to be an API I was not aware of. I will pass this on accordingly.

Best,
Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants