Skip to content

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

Closed

Description

@odedre

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

Activity

  1. davidfirst commented on Apr 10, 2020

    @davidfirst
    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).

  2. l0gicgate commented on Apr 14, 2020

    @l0gicgate

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

  3. GiladShoham commented on Apr 19, 2020

    @GiladShoham
    Member

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

  4. removed their assignment
    on Jun 19, 2020
  5. itaymendel commented on Mar 7, 2021

    @itaymendel
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions