{"id":13725998,"url":"https://github.com/swissmanu/pattern-matching-with-typescript","last_synced_at":"2025-10-19T06:30:34.201Z","repository":{"id":141004078,"uuid":"93674522","full_name":"swissmanu/pattern-matching-with-typescript","owner":"swissmanu","description":"TypeScript does not have any pattern matching functionality built in. This article shows several ways how you can replicate the core of a simple pattern matcher using a few simple structures and functions within TypeScript.  Resulting code will have improved maintainability and better runtime type safety when done right.","archived":false,"fork":false,"pushed_at":"2019-08-10T12:14:08.000Z","size":131,"stargazers_count":73,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-29T06:17:33.539Z","etag":null,"topics":["article","maintainability","pattern-matching","typescript"],"latest_commit_sha":null,"homepage":"https://alabor.me/2017/07/05/pattern-matching-with-typescript.html","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swissmanu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-07T20:01:12.000Z","updated_at":"2025-01-18T14:25:09.000Z","dependencies_parsed_at":"2024-01-27T11:54:57.441Z","dependency_job_id":null,"html_url":"https://github.com/swissmanu/pattern-matching-with-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fpattern-matching-with-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fpattern-matching-with-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fpattern-matching-with-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swissmanu%2Fpattern-matching-with-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swissmanu","download_url":"https://codeload.github.com/swissmanu/pattern-matching-with-typescript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237073136,"owners_count":19251036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["article","maintainability","pattern-matching","typescript"],"created_at":"2024-08-03T01:02:46.577Z","updated_at":"2025-10-19T06:30:33.831Z","avatar_url":"https://github.com/swissmanu.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Pattern Matching with TypeScript\n\n\u003e [TypeScript](https://www.typescriptlang.org/index.html) does not have any pattern matching functionality built in. This article shows several ways how you can replicate the core of a simple pattern matcher using a few simple structures and functions within TypeScript.\n\u003e\n\u003e Resulting code will have improved maintainability and better runtime type safety when done right.\n\nThis is the backing repository for the article \"Pattern Matching with TypeScript\" published under https://alabor.me/2017/07/05/pattern-matching-with-typescript.html\n\n## Examples\n\nThe `examples/` directory contains example code which goes along with the article read. Every example is fully executable.\n\nYou can run the examples by cloning or downloading this repository. Run `npm install` to install [TypeScript](https://www.typescriptlang.org/index.html) and [Jest](https://facebook.github.io/jest/). `npm test` executes the test suite for the examples.\n\n😎 Pro tip: Run `npm test -- --watch` if you want to tinker with the code and rerun the test suite automatically.\n\n## Article\n\nGithub Pages is used to serve the article to you. You find its text and all assets in the `gh-pages` branch.\n\n## Credits\n\n❤️ Thanks to my reviewers for advises and proofreading:\n\n* [@dbrack](https://github.com/dbrack)\n* [@mweibel](https://github.com/mweibel)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissmanu%2Fpattern-matching-with-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswissmanu%2Fpattern-matching-with-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswissmanu%2Fpattern-matching-with-typescript/lists"}