{"id":16528379,"url":"https://github.com/danvk/ts-reftrans","last_synced_at":"2026-06-20T12:33:28.082Z","repository":{"id":66069078,"uuid":"155717827","full_name":"danvk/ts-reftrans","owner":"danvk","description":"Demonstration of issues around referential transparency and type inference in TypeScript","archived":false,"fork":false,"pushed_at":"2018-11-01T13:33:20.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-17T00:17:36.089Z","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/danvk.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}},"created_at":"2018-11-01T13:17:29.000Z","updated_at":"2019-09-27T04:45:05.000Z","dependencies_parsed_at":"2023-03-18T00:31:23.681Z","dependency_job_id":null,"html_url":"https://github.com/danvk/ts-reftrans","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danvk/ts-reftrans","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fts-reftrans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fts-reftrans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fts-reftrans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fts-reftrans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvk","download_url":"https://codeload.github.com/danvk/ts-reftrans/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Fts-reftrans/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34570537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-11T17:40:08.415Z","updated_at":"2026-06-20T12:33:28.063Z","avatar_url":"https://github.com/danvk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Referential Transparency and TypeScript\n\nThis repo contains [code samples](src/) from a talk I gave at [TSNYC 3.1.1][meetup].\n\nTo view the samples yourself in vscode, run:\n\n    git clone https://github.com/danvk/ts-reftrans.git\n    cd ts-reftrans\n    yarn\n    code .\n\nFor more of a writeup, see [this issue][issue] on the TypeScript repo.\n\nThe improvement on `Partial` that I presented is a variant on some code from\n[this question][trick] on Stack Overflow. It's like `Pick` but infers the keys\nthat you want to pick:\n\n```ts\nconst inferringPick = \u003cV\u003e() =\u003e \u003cK extends keyof V\u003e(x: Pick\u003cV, K\u003e): Pick\u003cV, K\u003e =\u003e x;\n\n// v's type is inferred as Pick\u003cRequestInit, 'method' | 'cache' | 'body'\u003e\nconst v = inferPick\u003cRequestInit\u003e()({\n  method: 'GET',\n  cache: 'no-cache',\n  body: 'hello world'\n});\n```\n\n[meetup]: https://www.meetup.com/TypeScriptNYC/events/255170060/\n[issue]: https://github.com/Microsoft/TypeScript/issues/27502\n[trick]: https://stackoverflow.com/a/46101222/388951\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Fts-reftrans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvk%2Fts-reftrans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Fts-reftrans/lists"}