Skip to content
📐 Design pattern implementations in TypeScript
Branch: master
Clone or download
torokmark Merge pull request #13 from rugpanov/master
Improve SingletonPattern example
Latest commit c8d3500 Jun 19, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
abstract_factory Add abstractFactory demo Oct 19, 2016
adapter Add missing space Apr 20, 2018
builder Add demo to builder Oct 19, 2016
chain_of_responsibility Add demos Oct 22, 2016
command Add demos Oct 22, 2016
composite Add demos Oct 22, 2016
decorator Add demos Oct 22, 2016
facade Add demos Oct 22, 2016
factory_method factoryMethod: add a more TypeScript-y Factory fn Mar 6, 2018
flyweight Add demos Oct 22, 2016
interpreter Add demos Oct 22, 2016
iterator Combine condition check with return value Jun 3, 2017
mediator Add demos Oct 22, 2016
memento Add demos Oct 22, 2016
observer Add demos Oct 22, 2016
prototype Add demo to prototype Oct 19, 2016
proxy Add demos Oct 22, 2016
singleton Use semicolons Jun 19, 2018
strategy Add demos Oct 22, 2016
template_method Add demos Oct 22, 2016
visitor Update concrete class to implement the Element interface Dec 28, 2016
.gitignore Rename LICENSE to Dec 8, 2017 Add info to README Oct 22, 2016
main.ts added export to Singleton and removed src dir Dec 19, 2017

Design Patterns in TypeScript

Here are the implementations of the following design patterns in TypeScript:


Structural Patterns

Behavioral Patterns

Compile the project

$ git clone
$ cd design_patterns_in_typescript
$ tsc

There is a tsconfig.json file in the root directory which is responsible for the compiler options.

As it is set the default target is Ecmascript5 now.

Any additional options come here.

By default the output is a patterns.js file.

To compile only one pattern, use the following command.

$ cd design_patterns_in_typescript/visitor
$ tsc --target ES5 --module system --outFile visitor.js visitor.ts

Execute the project

After the compilation of the project, a patterns.js is generated by default. Executing the file is:

node patterns.js
You can’t perform that action at this time.