{"id":25859165,"url":"https://github.com/sajmoni/ts-elm","last_synced_at":"2026-04-15T13:31:38.900Z","repository":{"id":57380690,"uuid":"360989070","full_name":"sajmoni/ts-elm","owner":"sajmoni","description":"Elm types in TypeScript","archived":false,"fork":false,"pushed_at":"2023-02-10T09:08:35.000Z","size":625,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-19T11:53:01.199Z","etag":null,"topics":["elm","fp","functional-programming","result","typescript"],"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/sajmoni.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}},"created_at":"2021-04-23T19:42:38.000Z","updated_at":"2023-03-04T03:57:07.000Z","dependencies_parsed_at":"2025-03-01T20:41:08.501Z","dependency_job_id":"ac3a4b25-d39c-46fb-bdeb-da998be31b2b","html_url":"https://github.com/sajmoni/ts-elm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sajmoni/ts-elm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajmoni%2Fts-elm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajmoni%2Fts-elm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajmoni%2Fts-elm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajmoni%2Fts-elm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sajmoni","download_url":"https://codeload.github.com/sajmoni/ts-elm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajmoni%2Fts-elm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31842849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T13:28:40.153Z","status":"ssl_error","status_checked_at":"2026-04-15T13:28:29.396Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["elm","fp","functional-programming","result","typescript"],"created_at":"2025-03-01T20:39:44.375Z","updated_at":"2026-04-15T13:31:38.877Z","avatar_url":"https://github.com/sajmoni.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  ts-elm\n\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003e\n    Elm types in TypeScript\n\u003c/h4\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://badgen.net/npm/v/ts-elm?icon=npm\" /\u003e\n  \u003cimg src=\"https://badgen.net/bundlephobia/minzip/ts-elm\" /\u003e\n\u003c/div\u003e\n\nImplements [Elm's](https://elm-lang.org/) [`Result`](https://package.elm-lang.org/packages/elm/core/latest/Result) type in TypeScript. Use it to make error handling explicit.\nInstead of throwing errors, you create Results with the `ok` and `err` functions.\n\n## :sparkles: Benefits\n\n- Type signatures indicate if a function can fail or not\n- Ensures that errors are always handled\n- Work with the data as if it always succeeds and add error handling where it makes the most sense\n- Fully typed\n- Zero dependencies\n\n---\n\n## :wrench: Example usage\n\n---\n\n## :package: Install\n\n```sh\nnpm install ts-elm\n```\n\n---\n\n## :newspaper: API\n\nThe goal of the API is to be as similar to the original Elm code as possible.\n\nThere is purposefully no type guards to detect if a `Result` is `Ok` or `Err`. This is to force the use\nof `match`, which ensures that Errors are always handled.\n\n### Type and Constructors\n\n```ts\ntype Result\u003cValue, Error\u003e = Ok\u003cValue\u003e | Err\u003cError\u003e\n```\n\nA Result is either Ok meaning the computation succeeded, or it is an Err meaning that there was some failure.\n\n### Mapping\n\n```ts\ntype map = ((x: any) =\u003e any, result: Result) =\u003e Result\n```\n\nApply a function to a result. If the result is Ok, it will be converted. If the result is an Err, the same error value will propagate through.\n\nExample:\n\n```ts\nmap(Math.sqrt, ok(4)) // ok(2)\nmap(Math.sqrt, err('Bad input')) // err('Bad input')\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajmoni%2Fts-elm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsajmoni%2Fts-elm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajmoni%2Fts-elm/lists"}