Skip to content

Angular proxy generator adds self-import in models.ts for DTOs in the same namespace (ABP 9.3.5) #25080

@mahmut-gundogdu

Description

@mahmut-gundogdu

Is there an existing issue for this?

  • I have searched the existing issues

Description

When generating Angular proxies, ABP generates an unnecessary (and invalid) self-import inside the generated models.ts.

If a DTO type is declared in the same namespace (thus generated into the same models.ts file), the generator still emits an import like:

import type { TransactionDto } from './models';

But this line is inside models.ts itself, so it becomes a self-import and causes an Angular/TypeScript compile-time error.

This seems to happen when a custom DTO inherits from PagedResultDto and uses a DTO type parameter T that is in the same namespace.

Reproduction Steps

Create the following DTO in your Http API / Application Contracts layer (example):

public class TransactionDto { }

public class TransactionPagedResultDto : PagedResultDto<TransactionDto>
{
    public List<TransactionAmountSummary> AmountSummary { get; set; } = []; // or it could be more simple like int
}

Ensure TransactionPagedResultDto and TransactionDto are in the same C# namespace.

Use it as a return type of an endpoint:

[HttpGet]
public virtual async Task<TransactionPagedResultDto> GetListAsync()
{
    ...
}

Generate Angular proxies (ABP CLI / proxy generate workflow).

Expected behavior

models.ts contains a self-import similar to:

import type { TransactionDto } from './models';

This causes Angular/TypeScript compilation to fail (self-referencing module import).

Actual behavior

build error.

Image

Regression?

No response

Known Workarounds

after the abp generate-proxy -t ng. Remove the line on models.ts

Version

9.3.5

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

macOS

Other information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions