This repo contains a collection of helpful code snippets in TypeScript for several topics. See snippets
folder for the actual code snippets. They are grouped into modules by topic.
Since there are so many ways to build and pack TypeScript applications, prebuild versions of the code snippets are no longer provided. Just take the snippets directly from the source code files. Just make sure to preserve the copyright notice at the top of the file.
All files should start with this line:
/*! <name> <version> | MIT | https://github.com/hd-code/typescript-snippets */
<name>
is the name of the package, it usually corresponds with the filename<version>
is the version number in classical semver format (e.gv1.2.3
)
Make sure to update the version number after changing a snippet.
There a several scripts to support development.
npm start
: run all scripts belownpm test
: run all unit testsnpm run coverage
: display test coverage for all unit testsnpm run format
: auto format all snippets with prettier
The scripts can also be run for the modules in ideas
directory by appending :ideas
to the commands above.
Alway run npm start
before committing