You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since v0.11.0, when adding a CDS function that returns a value of an enum type, cds-typer fails when the enum is accessed not directly but through another entity. The output then contains a TypeError: n.match is not a function in /lib/util.js:70
Expected Behavior
cds-typer should not fail on the given example.
Steps To Reproduce
# db/stuff.cds
namespace stuff;
type Language : String enum {
DE = 'German';
EN = 'English'
}
entity Books {
title : String;
language : Language;
}
# srv/test-service.cds
using {stuff} from '../db/stuff';
service TestService {
entity AvailableBooks as projection on stuff.Books;
function readOneBook() returns {
title : stuff.Books:title;
language : stuff.Books:language; // <-- Error. Simply accessing "stuff.Language" works fine though.
}
}
Environment
cds-typer version: v0.11.1 **(does not occur on v0.10.0)**
Other versions:
@cap-js/sqlite: 1.3.1
@sap/cds: 7.3.0
@sap/cds-compiler: 4.3.0
@sap/cds-dk (global): 7.2.0
@sap/cds-fiori: 1.1.0
@sap/cds-foss: 4.0.2
@sap/cds-mtxs: 1.11.0
@sap/eslint-plugin-cds: 2.6.3
Node.js: v18.18.0
Repository Containing a Minimal Reproducible Example
thanks for reporting this issue -- good catch!
Glad you also found a workaround which will hopefully carry you over until the problem is resolved.
I'm afraid I will be out of office until November, so it will take a while before this will be fixed (unless of course you'd like to submit a PR, which is always welcome).
Thanks for the quick response! While I probably won't have the time to write a fix myself, I took the liberty to raise another issue we encountered 😃 However, I hope you first enjoy your time off work.
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
Since v0.11.0, when adding a CDS function that returns a value of an enum type, cds-typer fails when the enum is accessed not directly but through another entity. The output then contains a TypeError: n.match is not a function in /lib/util.js:70
Expected Behavior
cds-typer should not fail on the given example.
Steps To Reproduce
Environment
Repository Containing a Minimal Reproducible Example
https://github.com/rgrenz/cds-typer-issue
Anything else?
No response
The text was updated successfully, but these errors were encountered: