Starts in:
2 DAYS
4 HRS
8 MIN
48 SEC
Starts in:
2 D
4 H
8 M
48 S
Open Closed

Generation of Service Proxies for Angular not handling subclasses of PagedResultDto<T> correctly #6657


User avatar
0
dmannion created

In our Application.Contracts, we have the following class: public class MyEntityCustomPagedResultDto : PagedResultDto<MyEntityDto>

After running abp generate-proxy -t ng, the angular app fails to compile with this error: error TS2440: Import declaration conflicts with local declaration of 'MyEntityDto'

The resulting models.ts file includes both an import for MyEntityDto and and interface definition for MyEntityDto: import type { MyEntityDto } from './models';

Also, a slightly different error results if the custom class is instead defined like this: public class MyEntityCustomPagedResultDto<T> : PagedResultDto<T>

After running abp generate-proxy -t ng, the angular app fails to compile with this error: error TS2305: Module '"../../../models"' has no exported member 'T'.

The resulting models.ts file includes the following import: import type { T } from '../../../models';

  • ABP Framework version: v8.0.2
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

7 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    can you please check and share error logs.

  • User Avatar
    0
    paul.harriman created

    We are experiencing the same issue. we generate the proxies, no problems. then we try and build or start the angular project, then we get errors. if we remove the generics issues from the proxies, eveything builds. what error logs are you looking for?

    Error: src/app/proxy/client-models/models.ts:6:15 - error TS2305: Module '"../models"' has no exported member 'TKey'.

    6 import type { TKey } from '../models'; ~~~~

    Error: src/app/proxy/models.ts:2:15 - error TS2303: Circular definition of import alias 'T'.

    2 import type { T } from './models'; ~ Error: src/app/proxy/models.ts:2:15 - error TS2459: Module '"./models"' declares 'T' locally, but it is not exported.

    2 import type { T } from './models'; ~ src/app/proxy/models.ts:2:15 2 import type { T } from './models'; ~ 'T' is declared here.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    can you check logs under this path MyApp\aspnet-core\src\MyApp.HttpApi.Host\Logs ? please share if any logs?

  • User Avatar
    0
    paul.harriman created

    please tell me where to to send them to. there is some sensitive info in them.

    • i started the backend up.
    • did a generate proxy
    • started up the front end, got the angular error
    • made a copy of todays log. doesn't look like much besides normal stuff
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    Please check you error logs for any error. If is there any error just share that error message.

    I am not exactly sure but i think there is something wrong with your EntityName (MyEntityDto) can you please check by changing it.

    Thank you.

  • User Avatar
    0
    paul.harriman created

    i did not see any error in the logs. the code that i think is causing the issue has been there for a year, so it is not new code. generate proxies is creating the issue. you can see it in the git differences that it is new code. are you saying we can no longer use generics in our method signatures/entities?

    public virtual async Task<PagedResultDto<CompareLookupDto<int?>>> GetLookupAsync(LookupRequestDto input) { return await _modelAppService.GetLookupAsync(input); }

    public class CompareLookupDto<TKey>: LookupDto<TKey> { public bool IsPublic { get; set; } }

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The generate-proxy command may not support all C# types, you can modify the generated code manually for now.

    Your questions credit has been refunded.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06