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] type error for this.read(req.subject) #360

Open
1 task done
Akatuoro opened this issue Dec 3, 2024 · 1 comment · May be fixed by #361
Open
1 task done

[BUG] type error for this.read(req.subject) #360

Akatuoro opened this issue Dec 3, 2024 · 1 comment · May be fixed by #361
Labels
bug Something isn't working

Comments

@Akatuoro
Copy link
Contributor

Akatuoro commented Dec 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  this.on (deductDiscount, async req => {
      return this.read(req.subject)
  })

leads to the type error

No overload matches this call.
  Overload 1 of 2, '(entity: ArrayConstructable<any>, key?: any): Awaitable<SELECT_3<ArrayConstructable<any>, SELECT_from>, any[]>', gave the following error.
    Argument of type 'ref' is not assignable to parameter of type 'ArrayConstructable<any>'.
      Type 'ref' provides no match for the signature 'new (...args: any[]): any[]'.
  Overload 2 of 2, '(entity: string | Definition_2, key?: any): SELECT_3<unknown, SELECT_from>', gave the following error.
    Argument of type 'ref' is not assignable to parameter of type 'string | Definition_2'.ts(2769)

Expected Behavior

No response

References

Currently needs to be done via SELECT: https://github.com/SAP-samples/cap-sflight/blob/5154e2eece13485cfaa9f6ea041b3e6f81276743/srv/travel-service.ts#L100

Versions

@capire/sflight https://github.com/SAP-samples/cap-sflight
@cap-js/cds-typer 0.29.0
@cap-js/cds-types 0.8.0
@cap-js/db-service 1.16.0
@cap-js/hana 1.5.0
@cap-js/sqlite 1.7.7
@sap/cds 8.5.0
@sap/cds-compiler 5.5.0
@sap/cds-fiori 1.2.8
@sap/cds-foss 5.0.1
@sap/cds-mtxs 2.3.1
CAP Java SDK 3.5.0
Java 21.0.5, home: /Library/Java/JavaVirtualMachines/sapmachine-21.
Maven 3.6.3
Node.js v22.7.0
OS Mac OS X, 14.6.1, arch: x86_64
Spring Boot 3.4.0
cds4j 3.5.0

Anything else? Logs?

No response

@Akatuoro Akatuoro added the bug Something isn't working label Dec 3, 2024
@daogrady daogrady linked a pull request Dec 3, 2024 that will close this issue
@daogrady
Copy link
Contributor

daogrady commented Dec 3, 2024

Hi Johannes,

thanks for reporting this gap! I have prepared a fix.

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

Successfully merging a pull request may close this issue.

2 participants