{"id":17492404,"url":"https://github.com/kakasoo/proto-typescript","last_synced_at":"2026-03-07T00:32:24.682Z","repository":{"id":210536720,"uuid":"726787736","full_name":"kakasoo/proto-typescript","owner":"kakasoo","description":"Utility types and implementations based on JavaScript prototypes.","archived":false,"fork":false,"pushed_at":"2025-02-01T04:35:59.000Z","size":322,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-07T06:33:19.223Z","etag":null,"topics":["es6","iterable","iterator","javascript","prototype","type-safe","typescript","utility-types"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@kakasoo/proto-typescript","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/kakasoo.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":"2023-12-03T12:04:49.000Z","updated_at":"2025-10-06T09:22:38.000Z","dependencies_parsed_at":"2023-12-03T14:26:28.695Z","dependency_job_id":"d046606f-f43b-46ca-9058-386bbeabbc57","html_url":"https://github.com/kakasoo/proto-typescript","commit_stats":null,"previous_names":["kakasoo/proto-typescript"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kakasoo/proto-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kakasoo%2Fproto-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kakasoo%2Fproto-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kakasoo%2Fproto-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kakasoo%2Fproto-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kakasoo","download_url":"https://codeload.github.com/kakasoo/proto-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kakasoo%2Fproto-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["es6","iterable","iterator","javascript","prototype","type-safe","typescript","utility-types"],"created_at":"2024-10-19T09:04:16.053Z","updated_at":"2026-03-07T00:32:24.655Z","avatar_url":"https://github.com/kakasoo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proto-typescript\n\nUtility types and implementations based on JavaScript prototypes.\nI plan to share the features that are officially available from 2.0.0.\n\n# TypedClass\n\n## prototype methods\n\n```ts\nnew TypedArray([1, 2, 3] as const).unshift(4 as const); // TypedArray\u003c[4, 1, 2, 3]\u003e\n```\n\n```ts\nnew TypedArray([1, 2, 3] as const).join(','); // TypedString\u003c'1,2,3'\u003e\n```\n\nThe return result of 'TypeClass' returns one of the instances of TypeClass again. Therefore, those who know the grammar of JavaScript can use it immediately.\n\n## `refined` methods\n\n```ts\n/**\n * error case\n */\nnew TypedArray\u003c'1-3'\u003e([1, 2, 3]).refine([1, 2, 3] as const).join('-');\nnew TypedArray\u003c'1-3'\u003e([]).refine([1, 2, 3] as const).join('-');\nnew TypedArray\u003c'1-3'\u003e().refine([1, 2, 3, 4] as const).join('-');\nnew TypedArray\u003c'1-3'\u003e().refine([0, 1, 2, 3] as const).join('-');\n\n/**\n * right case\n */\nnew TypedArray\u003c'1-3'\u003e().refine([2, 3] as const).join('-');\n```\n\n`TypedArray`, `TypedNumber` has the `refine` method, which serves to further narrow down the generic type received as a factor. This helps reduce developer mistakes, but it should be careful because it cannot guarantee actual runtime behavior.\n\n\u003e In the future, improvements will be made at the type level.\n\n## toPrimitive method\n\n```ts\nnew TypedString('abcdef').toPrimitive(); // 'abcdef'\n```\n\nYou can change it to the primitive type of JavaScript.\n\n```ts\nconst arr = [...new TypedArray([1, 2, 3, 4, 5] as const)]; // (1 | 2 | 3 | 4 | 5)[]\n```\n\n`Iterable/Iterator` is supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkakasoo%2Fproto-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkakasoo%2Fproto-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkakasoo%2Fproto-typescript/lists"}