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] Error "... has no exported member ..." in generated code #145

Open
1 task done
mcastrup opened this issue Jan 17, 2024 · 6 comments
Open
1 task done

[BUG] Error "... has no exported member ..." in generated code #145

mcastrup opened this issue Jan 17, 2024 · 6 comments
Labels
bug Something isn't working keepalive Will not be closed by Stale bot

Comments

@mcastrup
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Nature of Your Project

TypeScript

Current Behavior

In one of the generated files, there are two errors regarding the import and usage of "Currencies":

image

Error message:
'"c:/Users/D048091/git/crypto-for-business/@cds-models/sap/common/index"' has no exported member named 'Currencies'. Did you mean 'Currency'?

The code can be also seen in this file:

export function _FiatCurrencyAspect<TBase extends new (...args: any[]) => object>(Base: TBase) {
  return class FiatCurrency extends Base {
        name?: string | null;
        descr?: string | null;
        code?: string;
        symbol?: string | null;
        minorUnit?: number | null;
        texts?: __.Composition.of.many<_sap_common.Currencies.texts>;
        localized?: __.Association.to<_sap_common.Currencies.text> | null;
    /**
    * Type for a language code
    */
        localized_locale?: _sap_common.Locale | null;
        localized_code?: string | null;
      static actions: {
    }
  };
}

The related entity to the FiatCurrency class is:

using {sap.common.Currencies} from '@sap/cds-common-content';

namespace sap.erp4sme.c4b.payment.fiatCurrencies;

@cds.persistence.skip: false
entity FiatCurrencies as select from Currencies;

See also this file.

Expected Behavior

I'm not sure what is the correct code. Of course, there should be no errors.

Steps To Reproduce

You can clone our repository crypto-for-business locally with
git clone https://github.tools.sap/erp4sme/crypto-for-business.git,
checkout the branch switch_to_typer_prototype and run
npm ci
and
npm run cds-typer:dev

Environment

- **OS**: Windows
- **Node**: v18.13.0
- **npm**: 8.19.3
- **cds-typer**: 0.15.0
- **cds**: 7.4.1

Repository Containing a Minimal Reproducible Example

No response

Anything else?

No response

@mcastrup mcastrup added bug Something isn't working new labels Jan 17, 2024
@hakimio
Copy link

hakimio commented Jan 17, 2024

Is the issue fixed if you import sap.common.Currencies from @sap/cds/common instead of @sap/cds-common-content? The definition will be the same.

@mcastrup
Copy link
Author

Hi @hakimio
I changed the import as you suggested to
using {sap.common.Currencies} from '@sap/cds/common';
However, the error still exists.

@daogrady
Copy link
Contributor

Hi Michael,

this issue is actually closely related to #77

Localisation and text properties are not supported by cds-typer at this point in time. So it is to be expected that their type is incorrect. I am more suprised that cds-typer attempts to generate them regardless, as we are currently skipping them. I will look into it.

Best,
Daniel

@daogrady daogrady removed the new label Jan 18, 2024
@mcastrup
Copy link
Author

Hi Daniel,

do you have an idea, when this issue will be fixed? It currently blockes our build process.

Thanks and best regards,
Michael

@daogrady
Copy link
Contributor

Hi Michael,

sorry, I am afraid not any time soon from my side, as I have to prioritise another project for an upcoming release. If you would like to submit a PR to address the problem, I will make sure to carve out some time to review it to make sure the issue is fixed asap.

Best
Daniel

Copy link

This issue has not been updated in a while. If it is still relevant, please comment on it to keep it open. The issue will be closed soon if it remains inactive.

@github-actions github-actions bot added the stale label Feb 28, 2024
@daogrady daogrady added keepalive Will not be closed by Stale bot and removed stale labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keepalive Will not be closed by Stale bot
Projects
None yet
Development

No branches or pull requests

3 participants