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

bit doesn't recognize exported types when they are in a separate file #2306

Closed
odedre opened this issue Feb 6, 2020 · 4 comments
Closed

Comments

@odedre
Copy link
Member

odedre commented Feb 6, 2020

Describe the bug

I have a component that exports the component along with its types. when I run bit build, I get the following error:

⠄⠀ isolating component - concrete/cta-buttonbase/primary-button/index.tsx:3:10 - error TS2305: Module '"../../../../../T/bit/capsule-92348/.dependencies/base/primary-button/bit.marketing/0.0.1/dist"' has no exported member 'ButtonProps'.

3 import { ButtonProps } from '@bit/bit.marketing.base.primary-button';
           ~~~~~~~~~~~


Found 1 error.


error: bit failed to build bit.marketing/concrete/cta-button@0.0.1 with the following exception:
Command failed with exit code 2 (ENOENT): /Users/oded/code/base-components/.git/bit/components/compilers/react-typescript/bit.envs/3.1.43/components/.dependencies/compilers/typescript/bit.envs/3.1.38/node_modules/typescript/bin/tsc --declaration
Error: Command failed with exit code 2 (ENOENT): /Users/oded/code/base-components/.git/bit/components/compilers/react-typescript/bit.envs/3.1.43/components/.dependencies/compilers/typescript/bit.envs/3.1.38/node_modules/typescript/bin/tsc --declaration
    at makeError (/Users/oded/code/base-components/.git/bit/components/compilers/react-typescript/bit.envs/3.1.43/components/.dependencies/compilers/typescript/bit.envs/3.1.38/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/Users/oded/code/base-components/.git/bit/components/compilers/react-typescript/bit.envs/3.1.43/components/.dependencies/compilers/typescript/bit.envs/3.1.38/node_modules/execa/index.js:112:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)

see the components here:
https://bit.dev/bit/marketing/concrete/cta-button
https://bit.dev/bit/marketing/base/primary-button
https://bit.dev/bit/gui/base/button

these components enhance the prev component and have them as a dependency along with their types.

cta-button -> primary-button -> base/button

the problem was resolved when I tagged base/primary-button with the --skip-auto-tag flag.
the I could tag concrete/cta-button.

Steps to Reproduce

  1. import the following components:
  • bit import bit.gui/base/button@0.0.8
  • bit import bit.marketing/base/primary-button@0.0.2
  • bit import bit.marketing/concrete/cta-button@0.0.2
  1. modify base/primary-button
  2. run bit tag -a

Expected Behavior

bit should recognize the exported types.

Specifications

  • Bit version: 14.7.2
  • Node version: v10.15.3
  • yarn version: 1.13.0
  • Platform: macos
  • Bit compiler (include version): bit.envs/compilers/react-typescript@3.1.43
  • Bit tester (include version): bit.envs/testers/mocha@5.0.2
@davidfirst
Copy link
Member

This is probably a result of the useless dists generated by TS compiler for the author.
When using module paths, typescript tries to resolve the component from the dists and more often than not, it doesn't find them there.
It's going to be fixed with the next major version (Harmony).

@l0gicgate
Copy link

I'm experiencing the exact same problem. Is there a workaround for now?

@GiladShoham
Copy link
Member

@odedre How did you workaround this?
@Tallyb @qballer any idea about how to work around it?

@qballer qballer removed their assignment Jun 19, 2020
@itaymendel
Copy link
Contributor

irrelevant for v15

We'll start rolling out v15 of Bit this week, please reach out to me privately on the public slack community for a sneak peek and getting early access to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants