reimiii / ts-generic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setup this for node

npm init

# after init add "type": "module" in package.json
#

npm install --save-dev jest @types/jest babel-jest @babel/preset-env

go to babel

setup this for typescript

npm install --save-dev typescript && npx tsc --init

config in tsconfig.json change "module" from "commonjs" to "ES6"

setup this for using jest in typescript

go to jest and setup

npm install --save-dev @babel/preset-typescript ts-jest @jest/globals @types/jest

in babel.config.json, in array present add this string "@babel/preset-typescript"

compile typescript

create dist, src and tests folder in root project dir and uncomment and change "outDir": "./" to "outDir": "dist/" in tsconfig.json and compile with

npx tsc

output compile in dist/

run jest / test

npx jest

include exclude example in tsconfig.json

{
  "include": [
    "src/**/*",
    "tests/**/*"
  ],
  "exclude": [
    "tests/**/*"
  ]
}

in test not error in compile error use this to watch compile

npx tsc --watch

About


Languages

Language:TypeScript 100.0%