{"id":15170730,"url":"https://github.com/lostintime/pick-ts","last_synced_at":"2025-10-01T05:30:53.841Z","repository":{"id":57323827,"uuid":"151288779","full_name":"lostintime/pick-ts","owner":"lostintime","description":"Pick selected object fields","archived":true,"fork":false,"pushed_at":"2018-10-02T16:52:25.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T21:49:25.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lostintime.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}},"created_at":"2018-10-02T16:41:56.000Z","updated_at":"2023-04-30T18:27:18.000Z","dependencies_parsed_at":"2022-09-20T23:30:14.931Z","dependency_job_id":null,"html_url":"https://github.com/lostintime/pick-ts","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/lostintime%2Fpick-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostintime%2Fpick-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostintime%2Fpick-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lostintime%2Fpick-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lostintime","download_url":"https://codeload.github.com/lostintime/pick-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234827057,"owners_count":18892884,"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":[],"created_at":"2024-09-27T08:22:27.870Z","updated_at":"2025-10-01T05:30:53.501Z","avatar_url":"https://github.com/lostintime.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Pick-TS\n=======\n\n[![Travis](https://img.shields.io/travis/lostintime/pick-ts.svg)](https://travis-ci.org/lostintime/pick-ts)\n[![Coverage Status](https://codecov.io/gh/lostintime/pick-ts/coverage.svg?branch=master)](https://codecov.io/gh/lostintime/pick-ts?branch=master)\n[![Greenkeeper badge](https://badges.greenkeeper.io/lostintime/pick-ts.svg)](https://greenkeeper.io/)\n\nA _best-effort_ typesafe(er\u003csup\u003e1\u003c/sup\u003e) function to _pick_ selected object fields.\n\n```typescript\nimport pick from \"pick-ts\"\n\nconst person = {\n  name: \"John\",\n  age: 20\n}\n\ntype Named = {\n  name: string\n}\n\n// These lines works\nconst n: Named = pick(\"name\")(person)\nconst p: Person = pick(\"name\", \"age\")(person)\n\n// But this will fail at compilation time\nconst t = pick(\"title\")(person)\nconst z: Named = pick(\"title\")({ title: \"Aloha\" })\n```\n\n\n## Limitations\n\n1. As picked type is infered from pick argument value types - setting explicit keys type will break result type:\n\n```typescript\ntype Person = {\n  name: string\n  age: number\n}\n\n// This will compile, but doesn't work as expected!\nconst p: Person = pick\u003ckeyof Person\u003e()({ name: \"John\", age: 20 })\n```\n\n### Related Links\n\n  * https://github.com/Microsoft/TypeScript/issues/13298\n\n## Contribute\n\n\u003e Perfection is Achieved Not When There Is Nothing More to Add, \n\u003e But When There Is Nothing Left to Take Away\n\nFork, Contribute, Push, Create pull request, Thanks. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flostintime%2Fpick-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flostintime%2Fpick-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flostintime%2Fpick-ts/lists"}