nest-cli icon indicating copy to clipboard operation
nest-cli copied to clipboard

Support for relative path conversion on .d.ts files

Open Farenheith opened this issue 3 years ago • 0 comments

Is there an existing issue that is already proposing this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe it

If I use nest build and my project emits .d.ts files, they still have to use the aliased path on the imports, what not happen with .js.

For test purposes, let's have this path configured:

    "paths": {
      "@core/*": [
        "./src/*"
      ]

I have one file with this line:

export * from '@core/test';

When I transpile it emitting types, the .js looks fine:

__exportStar(require("./test"), exports);

Which is fine, but the .d.ts still looks like this:

export * from '@core/test';

This causes a bad type detection if I use nest build to compile a library, for example, and try to import it into some other project.

Describe the solution you'd like

Replace the aliased path by the relative one also in the .d.ts files when compilng

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

If the aliased path could be replaced by the relative one also in the .d.ts files, it would allow us to use nest build even to compile a library, for example, letting us have the easiness of using the aliased path in any kind o project

Farenheith avatar Aug 18 '22 08:08 Farenheith