gcanti / fp-ts

Functional programming in TypeScript
https://gcanti.github.io/fp-ts/
MIT License
10.63k stars 503 forks source link

Importing "fp-ts/Array" causes compilation errors on Typescript 4.7.4 #1885

Closed jefshe closed 1 year ago

jefshe commented 1 year ago

🐛 Bug report

Current Behavior

Given this simple example:

import * as A from "fp-ts/Array";

export function test() {
  return A.map(a => a);
}

and my tsconfig:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "ES2018",
    "outDir": "./build",
    "sourceMap": true,
    "resolveJsonModule": true
  },

  "include": ["src/**/*"]
}

I get the following compile errors when I run tsc: image

Oddly enough importing TaskEither and Either both compile fine. It's only when I introduce the Array import. Is there something I'm missing here?

Expected behavior

No compliation errors

Your environment

Software Version(s)
fp-ts 2.16.0
TypeScript 4.7.4
gcanti commented 1 year ago

can't repro

the only thing I can think about is

Make sure to always have a single version of fp-ts installed in your project. Multiple versions are known to cause tsc to hang during compilation. You can check the versions currently installed using npm ls fp-ts (make sure there's a single version and all the others are marked as deduped).

jefshe commented 1 year ago

Thank you for looking into this so promptly. Yes it turned out to be related to my mono repo setup. Thanks for the help!