salesforce / design-system-react

Salesforce Lightning Design System for React
https://react.lightningdesignsystem.com/
BSD 3-Clause "New" or "Revised" License
909 stars 411 forks source link

Incorrect TS declaration files within /module? #3113

Closed pmartin35 closed 1 year ago

pmartin35 commented 1 year ago

I am trying to get the components located within the /module directory to work with TypeScript.

When doing the following:

import Input from '@salesforce/design-system-react/module/components/input';

I get the following error:

node_modules/@salesforce/design-system-react/components/input.d.ts' is not a module.

It seems like the components in the /module folder have the following type declaration:

declare module '@salesforce/design-system-react/components/input' {...}

Is the missing /module intended? If so, how do I go about making the TS compiler recognize the type definition?

pmartin35 commented 1 year ago

Closing as I fixed by adding a vite alias:

resolve: {
    alias: {
         "@salesforce/design-system-react/components": path.resolve(__dirname, 'node_modules/@salesforce/design-system-react/module/components')
    }
}