How do I make Javascript files work in a Typescript tsup bundle?

384 views Asked by At

I am trying to build a tsup bundle that contains both Javascript (.js) and Typescript (.tsx). According to their docs, that is possible.

When I build with the tsup command, I get the following error message:

rc/index.tsx(7,15): error TS7016: Could not find a declaration file for module './Test'.

Here is a sandbox MVP: https://shorturl.at/fyOY3

How do I make it build without errors?


EDIT:

I was able to make the above error go away by adding the following to tsconfig.json:

"compilerOptions": {
  "allowJs": true,
  "checkJs": false
}

However, now a new error message appears:

TypeError: a.default.createContext is not a function

I think it is related to how the bundler handles styled-components in the monorepo.

0

There are 0 answers