gcanti / fp-ts

Functional programming in TypeScript

Home Page:https://gcanti.github.io/fp-ts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find any documentation over setting up fp-ts on nodejs

SHND opened this issue · comments

commented

I'm having a hard time setting up a testing and learning node, typescript project to play around with fp-ts.

Adding a documentation on how to start a project from bare metal on different environments are pretty appreciated.

I could transpile this using tsc but I couldn't make it work with ts-node or deno.

commented

For anyone else like me who want to create a project to try things really quick add this to your package.json:

  1. npm init -y
  2. npm install fp-ts nodemon
  3. mkdir ./src/index.ts
  4. Add below to package.json
"start": "nodemon -w ./src/index.ts -q -x 'clear; tsc --strict ./src/index.ts --outDir ./build && node ./build/index.js'",
  1. Start watching your ./src/index.ts by running command below:
npm start

I met the some problem that fp-ts doesn't work on Node.js ES Module due to it's package.json declaration.
Have tried 3.0.0-alpha.26 and 2.13.1.

commented

Honestly I don't remember what was my initial issue and what I did to fix it, but something that I remember that was pretty helpful was the tsconfig.json in example directory in this repo. That file doesn't have anything special but it extends from the main repo tsconfig file. So if you have a hard time setting TypeScript for your project, use this tsconfig.json file here.

One of the configs that I remember was important is "strict": true

commented

I'm closing this since I don't have this issue anymore.