selfrefactor / rambdax

Extended version of Rambda
https://selfrefactor.github.io/rambdax
MIT License
221 stars 26 forks source link

fix: typescript errors when the isolatedModules flag is provided #56

Closed firede closed 4 years ago

firede commented 4 years ago

When I upgrade rambdax to 4.0, I got this:

./node_modules/rambdax/_ts-toolbelt/src/Any/_api.ts:3:9
Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

  1 | /** @ignore *//** */
  2 |
> 3 | export {Cast} from './Cast'
    |         ^
  4 | export {Clean} from './Clean'
  5 | export {Compute} from './Compute'
  6 | export {Contains} from './Contains'

So I created the PR to fix it, thanks.

selfrefactor commented 4 years ago

Thank you for the PR. I will use it as a base to fix the problem, as I have a pipeline that creates the local copy of ts-toolbelt. Approving the PR might fix the issue for this version, but it will be overwritten on the next bump.

Could you share your tsconfig.json file as I am curious which option cause this bug?

firede commented 4 years ago
{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "baseUrl": ".",
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": ["node_modules"],
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}

I think, isolatedModules: true will cause this bug.

selfrefactor commented 4 years ago

Yes, indeed isolatedModules: true is the cultpit. The issue is also reported in Rambda repo. I will apply the fix during the weekend.

selfrefactor commented 4 years ago

A fix is applied to Rambda and will be published tomorrow.

As for Rambdax - I was in the middle of adding new methods, so the fix will come after a few days.

selfrefactor commented 4 years ago

@firede I applied your changes to the whole ts-toolbelt pipeline and I made 4.2.0 release. Thanks again for your PR as it provided clear solution to important issue.

Let me know if you are still facing this issue with the latest Rambdax version.

selfrefactor commented 4 years ago

I am closing this PR as the changes are applied. Please comment if the issue is still present.