Issue: We're trying to move to Typescript but absolutely stuck on: TS2307: Cannot find module 'our-filesystem-platform' or its corresponding type declarations.
Context: We have a few imports that we swap out depending on the environment, and we resolve them to the correct name using babel-plugin-module-resolver.
Our .babelrc.js looks like:
{
"plugins": [
["module-resolver",
{
"alias": {
"our-filesystem-platform": "our-filesystem-rn",
}
}
]
]
}
And our tsconfig.json looks like:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"our-filesystem-platform": ["packages/native/our-filesystem-rn"],
}
}
}
I also tried "our-filesystem-platform": ["packages/native/our-filesystem-rn/src/index"] without any luck there either.
How can we fix this error without totally restructuring our project, or littering it with @ts-ignore? It seems like TypeScript demands that the resolved module name match the requested module name.
I saw this question but it's not quite the same, and we can't simply add * at the end of the paths to fix this.