dotkom / design-system

Component library, maybe
https://design.online.ntnu.no
MIT License
4 stars 4 forks source link

Typescript declarations are not exported correctly #148

Closed oleast closed 4 years ago

oleast commented 4 years ago

Describe the bug When including @dotkomonline/design-system in another project the type-declarations are not available to the project.

To Reproduce

  1. Include @dotkomonline/design-system in a Typescript project
  2. Import something from the package
  3. Use the Component/function/object for something
  4. See that no errors are visible when something is wrong, and that no type-hints are available for auto-completion.

Expected behavior I expected the modules to be typed.

Additional context My guess is that this has is because the types are exported with the root-relative paths in the design system.

Example from index.d.ts from the package:

import { colors } from 'common/colors';

This works in the design system itself because of the build steps in webpack, but it does not work when the module is used outside of the design-system project environment.

Manually changing the import to a relative path in ./node_modules/@dotkomonline/design-system/dist/index.d.ts makes it work:

import { colors } from './common/colors';