A series of pattern matching examples in Typescript
TL;DR
This POC was born during my experiment in Kotlin. I wanted to have when pattern matching in Typescript and I don't know how to do it.
Now I know how to do it
You will find the solutions under src folder with the corrective tests
├── LICENSE.md
├── README.md
├── __tests__
│ ├── index.spec.ts
│ └── PatternMatchingClassWithAdt.spec.ts
├── huskyrc.json
├── jest.config.js
├── package-lock.json
├── package.json
├── src
│ ├── PatternMatchingClassWithAdt.ts
│ └── index.ts
├── tsconfig.json
├── tsconfig.lint.json
└── tslint.json
yarn build
Outputed into lib/.
yarn test
yarn coverage
Open coverage/lcov-report/index.html in a browser.
yarn build transpiles the source codes from src/ to lib/.
See tsconfig.json.
husky provides hooks for git, e.g. pre-commit, pre-push.
lint-staged gives the git staging files to any command.
You can format and lint the source codes with them before they are commited.
See package.json and .lintstagedrc.json.
Jest is a test runner.
ts-jest let Jest run .ts files.
Riccardo Vecchi(reackonly)
These examples are licensed under the MIT License.
