Open sebastien-savalle opened 2 weeks ago
Same code works with cds-types
0.6.5 :(
Hi Sébastien,
thanks for reporting this issue!
This looks a bit like TS is trying to infer the type from the implementation files, which would imply you don't have cds-types installed in your project.
Please note that since cds8, @cap-js/cds-types
has to be installed explicitly and is no longer pulled in from @sap/cds
.
Did you add @cap-js/cds-types
as devDependency to your project and install it?
Best, Daniel
Actually, I am pretty sure this is a duplicate of https://github.com/cap-js/cds-types/issues/251
If you do have cds-types installed, can you please run (p
)npm rebuild
in your project and see, if that fixes the problem?
Hi Daniel,
Yes, we do have cds-types installed as you can see in the summary.
We use pnpm
, so this might be similar to the issue you mentioned.
But, this works well with version 0.6.5
.
pnpm rebuild
doesn't fix the issue. Most likely because of the issue with pnpm: https://github.com/cap-js/cds-types/issues/251#issuecomment-2468470167
Hi Sébastien,
can you please check out @hakimio's suggestion and see if that solves the problem for you? If it does, could you please also elaborate a bit on your setup? Do you use a monorepo? If so, do the submodules of that monorepo have a dependency on cds-types?
Best, Daniel
Is there an existing issue for this?
Current Behavior
We observed a weird behavior when migrating to
cds
8 andcds-types
0.7.0.Custom handler cannot be registered properly. A typescript error is thrown.
error TS2339: Property 'on' does not exist on type 'AdminService'.
But it works when this is cast to ApplicationService.
Expected Behavior
No response
References
https://pages.github.tools.sap/cap/docs/tools/cds-typer#typer-top-level-imports
Versions
Anything else? Logs?
No response