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

TypeScript types from internal packages are being imported from dist #10765

Closed
jasongerbes opened this issue Jun 16, 2022 · 4 comments
Closed

Comments

@jasongerbes
Copy link
Contributor

Current Behavior

An Nx workspace with multiple TypeScript libraries can resolve implicit types to imports from dist, for example:

// libs/lib-2/src/lib/lib-2.ts
import { TestFunction } from '@nx-example/lib-1';

export const testFunction: TestFunction = (arg: string) => arg;
// libs/lib-2/src/lib/test.ts
import { testFunction } from './lib-2';

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

Expected Behavior

All types from internal libraries should be resolved to the relevant node module, for example:

// dist/libs/lib-2/src/lib/test.d.ts
import { TestFunction } from '@nx-example/lib-1';
export declare const test: TestFunction;

Steps to Reproduce

See the related nx-examples PR: nrwl/nx-examples#205

Environment

Node : 16.14.2
OS   : darwin x64
yarn : 1.22.18

nx : 14.2.0-rc.1
@nrwl/angular : 14.2.0-rc.1
@nrwl/cypress : 14.2.0-rc.1
@nrwl/detox : Not Found
@nrwl/devkit : 14.2.0-rc.1
@nrwl/eslint-plugin-nx : 14.2.0-rc.1
@nrwl/express : Not Found
@nrwl/jest : 14.2.0-rc.1
@nrwl/js : 14.2.0-rc.1
@nrwl/linter : 14.2.0-rc.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : 14.0.5
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.2.0-rc.1
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.2.0-rc.1
@nrwl/web : 14.2.0-rc.1
@nrwl/workspace : 14.2.0-rc.1
typescript : 4.7.2
---------------------------------------
Community plugins:
    @ngrx/component-store: 13.2.0
    @ngrx/effects: 13.2.0
    @ngrx/entity: 13.2.0
    @ngrx/router-store: 13.2.0
    @ngrx/store: 13.2.0
    rxjs: 6.5.5
    @ngrx/store-devtools: 13.2.0
@wootencl
Copy link

I spent wayyy too long trying to figure out why I was seeing this issue in my project. Thanks a ton for the the workaround described in your PR @jasongerbes (and for this issue in general).

@Sceri
Copy link

Sceri commented Oct 26, 2022

fix pls

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants