{"id":23613651,"url":"https://github.com/freckle/exhaustive-js","last_synced_at":"2025-05-12T21:42:30.527Z","repository":{"id":42126695,"uuid":"479451996","full_name":"freckle/exhaustive-js","owner":"freckle","description":"Provides a helper function for checking exhaustiveness.","archived":false,"fork":false,"pushed_at":"2025-04-05T02:23:41.000Z","size":47,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-07T09:51:51.557Z","etag":null,"topics":["ghvm-managed"],"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/freckle.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-08T15:53:25.000Z","updated_at":"2025-03-28T23:04:01.000Z","dependencies_parsed_at":"2024-12-12T20:32:06.143Z","dependency_job_id":"4392614f-c69f-40ef-a026-355c9ec0521c","html_url":"https://github.com/freckle/exhaustive-js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freckle%2Fexhaustive-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freckle%2Fexhaustive-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freckle%2Fexhaustive-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freckle%2Fexhaustive-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freckle","download_url":"https://codeload.github.com/freckle/exhaustive-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253827891,"owners_count":21970596,"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":["ghvm-managed"],"created_at":"2024-12-27T17:18:36.667Z","updated_at":"2025-05-12T21:42:30.498Z","avatar_url":"https://github.com/freckle.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @freckle/exhaustive-js\n\nProvides a helper function for checking exhaustiveness. Exhaustiveness checking is a feature of a language where the type checker guarantees that all cases were covered.\n\n## Usage\n\n```js\nimport {exhaustive} from '@freckle/exhaustive-js'\n\ntype Status = 'success' | 'failure'\n\nfunction getStatusMessage(status: Status): string {\n  switch (status) {\n    case 'success':\n      return 'The operation completed successfully.'\n    case 'failure':\n      return 'The operation failed.'\n    default:\n      return exhaustive(status)\n  }\n}\n```\n\nUsage in a reducer where returning the state itself in the default case is a common pattern:\n```js\nimport {exhaustiveReducer} from '@freckle/exhaustive-js'\n\ntype TodoState = {...}\ntype TodoAction = {type: 'todoAdded', ...} | {type: 'todoToggled', ...}\n\nconst defaultTodoState = {...}\n\nfunction todoReducer(\n  state: TodoState = defaultTodoState,\n  action: TodoAction\n): TodoState {\n  switch (action.type) {\n    case 'todoAdded':\n      return {...}\n    case 'todoToggled':\n      return {...}\n    default:\n      return exhaustiveReducer(action.type, state)\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreckle%2Fexhaustive-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreckle%2Fexhaustive-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreckle%2Fexhaustive-js/lists"}