1

I have installed fp-ts in a javascript project with check-js enabaled, but for some reason I can't get the typings for the "fp-ts/function".

this is what I get:

import {flow} from 'fp-ts/function'
//Cannot find module 'fp-ts/function' or its corresponding type declarations.ts(2307)

here is my package.json

{
  "type": "module",
  "name": "somename",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "devDependencies": {
    "@types/node": "^18.0.6",
    "fp-ts": "^2.16.0",
    "glob": "^8.0.3",
    "typescript": "^4.7.4",
  }
}

tsconfig.json

{
  "compilerOptions": {
    "module": "NodeNext",                                /* Specify what module code is generated. */
    "allowJs": true,                                  /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
    "checkJs": true,                                  /* Enable error reporting in type-checked JavaScript files. */
    "outDir": "./dist",                                   /* Specify an output folder for all emitted files. */
    "esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
    "forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */
    "strict": true,                                      /* Enable all strict type-checking options. */
    "skipLibCheck": true                                 /* Skip type checking all .d.ts files. */
  },
  "include": [
    "./src/**/*"
  ],
}

any ideas what am I doing wrong here? I tried all other aliases for this package, get the same message "fp-ts/lib/function" or "fp-ts/es6/function".

EDIT: I have checked the repo and it seems it is a know issue: https://github.com/gcanti/fp-ts/issues/1799

But let me know if you know better workarounds.

Ricardo Silva
  • 1,221
  • 9
  • 19

0 Answers0