{"id":22445503,"url":"https://github.com/mistlog/typetype-examples","last_synced_at":"2026-04-08T14:01:33.945Z","repository":{"id":98858804,"uuid":"338749342","full_name":"mistlog/typetype-examples","owner":"mistlog","description":"Examples of using typetype to create typescript types","archived":false,"fork":false,"pushed_at":"2021-04-04T03:10:32.000Z","size":264,"stargazers_count":33,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T11:44:05.317Z","etag":null,"topics":["type","typescript","typetype"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"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/mistlog.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-14T07:09:18.000Z","updated_at":"2025-04-18T09:48:47.000Z","dependencies_parsed_at":"2023-05-25T20:15:15.907Z","dependency_job_id":null,"html_url":"https://github.com/mistlog/typetype-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mistlog/typetype-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistlog%2Ftypetype-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistlog%2Ftypetype-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistlog%2Ftypetype-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistlog%2Ftypetype-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mistlog","download_url":"https://codeload.github.com/mistlog/typetype-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mistlog%2Ftypetype-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266161905,"owners_count":23885928,"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":["type","typescript","typetype"],"created_at":"2024-12-06T03:15:00.348Z","updated_at":"2026-04-08T14:01:33.896Z","avatar_url":"https://github.com/mistlog.png","language":"TypeScript","readme":"# TypeType Examples\n\nThis repository contains examples of using [typetype](https://github.com/mistlog/typetype) to create typescript types, typetype is designed to generate complex typescript type with ease.\n\nFor example, to implement `StringToUnion` in [531-medium-string-to-union](https://github.com/type-challenges/type-challenges/blob/master/questions/531-medium-string-to-union/README.md):\n\n```ts\nexport type function StringToUnion = (T extends string) =\u003e ^{\n    if(T extends `${infer char}${infer rest}`) {\n        return union [char, StringToUnion\u003crest\u003e]\n    } else {\n        return never\n    }\n}\n```\n\nThe output will be:\n\n```ts\nexport type StringToUnion\u003cT extends string\u003e = T extends `${infer char}${infer rest}` ? (char | StringToUnion\u003crest\u003e) : never;\n```\n\nSee it in action!\n\n* https://mistlog.github.io/typetype-playground/\n\n## Outline\n\n```ts\nforeach example-set in this repo:\n    input = examples/\u003cexample-set\u003e/\u003cexample-name\u003e.type\n    output = examples/\u003cexample-set\u003e/\u003cexample-name\u003e.ts\n    test = examples/\u003cexample-set\u003e/\u003cexample-name\u003e.test.ts\n```\n\n* syntax: the grammar of typetype\n* url-parser\n    * url-parser: simple url parser, parse individual part of url\n    * url-parser-2: parse url as a whole\n* type-challenges\n    * solutions of [type-challenges](https://github.com/type-challenges/type-challenges) in typetype\n\n\n\n## Local setup\n\n```bash\n\u003e npm install\n\u003e npm run dev\n```\n\n## License\n\nThis project is [MIT licensed](https://github.com/mistlog/typetype-examples/blob/main/LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistlog%2Ftypetype-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmistlog%2Ftypetype-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistlog%2Ftypetype-examples/lists"}