nx-examples icon indicating copy to clipboard operation
nx-examples copied to clipboard

Issue with TypeScript declaration files

Open jasongerbes opened this issue 3 years ago • 2 comments

This PR demonstrates an issue with the TypeScript declaration files produced by tsc.

See the related Nx issue: https://github.com/nrwl/nx/issues/10765

Steps to reproduce:

  1. Run nx build lib-2.
  2. Open dist/libs/lib-2/src/lib/test.d.ts.
  3. Observe the broken import from dist.

Example of test.d.ts:

// dist/libs/lib-2/src/lib/test.d.ts
export declare const test: import("../../../../dist/libs/lib-1/src").TestFunction;

This issue doesn't occur when the file includes any (unrelated) imports from @nx-example/lib-1.

For example, lib-2/src/lib/test-2.ts imports the unrelated testValue from @nx-example/lib-1, which then causes TestFunction to be correctly imported (despite not being directly imported in test-2.ts):

// dist/libs/lib-2/src/lib/test-2.d.ts
export declare const test: import("@nx-example/lib-1").TestFunction;

jasongerbes avatar Jun 16 '22 03:06 jasongerbes

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 0d7679f42c9759ab165b0572a5d9c7ef97290eb1. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx affected:test --base 620de87a96bf08bcfbab0812badd08461203162a --parallel -- --ci --code-coverage
nx affected:lint --base 620de87a96bf08bcfbab0812badd08461203162a --parallel
✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Jun 16 '22 03:06 nx-cloud[bot]

Deploy Preview for nrwl-nx-examples-dep-graph ready!

Name Link
Latest commit 0d7679f42c9759ab165b0572a5d9c7ef97290eb1
Latest deploy log https://app.netlify.com/sites/nrwl-nx-examples-dep-graph/deploys/62aab543d5eaa20008f0ed96
Deploy Preview https://deploy-preview-205--nrwl-nx-examples-dep-graph.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Jun 16 '22 03:06 netlify[bot]