I have a React project with TypeScript. I'm trying to import types from an external folder - outside of the React folder. However, React does not seem to allow this. I'm using craco on top of CRA to run the app.
Project: https://github.com/accord-dot-app/app
types/
- ...
- deps.types.ts
frontend/
- ...
- src/
-- index.tsx
types/deps.types.ts:
// ... imports
export interface Deps {
...
}
frontend/src/index.tsx:
import { Deps } from '.../deps.types.ts';
...
This is the error I get when running craco start
.
File was processed with these loaders:
* ./node_modules/react-scripts/node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
You may need an additional loader to handle the result of these loaders.
| import ChannelLeave from '@accord/backend/ws/ws-events/channel-leave';
|
> declare interface Deps {
| channels: Channels;
| /** @deprecated */
If I comment out the lines, I just get another error in a another similar type file.
How can the errors be removed?