{"id":29290371,"url":"https://github.com/thomas-void0/t2t-tools","last_synced_at":"2025-10-13T10:35:47.259Z","repository":{"id":113417074,"uuid":"362094392","full_name":"thomas-void0/t2t-tools","owner":"thomas-void0","description":"type conversion tool of typescript.","archived":false,"fork":false,"pushed_at":"2024-01-16T07:35:43.000Z","size":7653,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-07T00:48:10.164Z","etag":null,"topics":[],"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/thomas-void0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-04-27T11:53:52.000Z","updated_at":"2024-04-25T12:36:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"30d0ddb8-c824-45f5-85cb-3aa66d86cbdb","html_url":"https://github.com/thomas-void0/t2t-tools","commit_stats":null,"previous_names":["thomas-void0/t2t-tools"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/thomas-void0/t2t-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-void0%2Ft2t-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-void0%2Ft2t-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-void0%2Ft2t-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-void0%2Ft2t-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomas-void0","download_url":"https://codeload.github.com/thomas-void0/t2t-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-void0%2Ft2t-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014646,"owners_count":26085555,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"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":"2025-07-06T06:03:59.055Z","updated_at":"2025-10-13T10:35:47.254Z","avatar_url":"https://github.com/thomas-void0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# t2t-tools \u003cimg src=\"https://img.shields.io/npm/v/t2t-tools.svg\" alt=\"npm package\"\u003e\n\nt2t-tools is type conversion tool of typescript.\n\n## Install\n\n```bash\nnpm install t2t-tools -D\n```\n\n## Usage\n\nAdd to a d.ts declaration file\n```ts\n/// \u003creference types=\"t2t-tools\" /\u003e\n```\n\nOR\n\nadd `t2t-tools` to `compilerOptions.types` inside tsconfig.json\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\"t2t-tools\"]\n  }\n}\n```\n\n## Example\n\n```ts\nimport { Merge } from 't2t-tools'\n\ntype A = Merge\u003c{ a: number; c: boolean }, { a: string; b: number }\u003e\n\n// A = { a: string; b: number; c: boolean }\n```\n\n## API\n\n|        方法名         |                         解释                          |\n| :-------------------: | :---------------------------------------------------: |\n| ConstructorParameters |       获取一个构造函数的参数类型，返回一个元组        |\n|    DeepNonNullable    |                深度去除null和undefined                |\n|      DeepPartial      |                    深度设置为可选                     |\n|     DeepReadonly      |                   深度设置readonly                    |\n|     DeepRequired      |                    全部设置为必选                     |\n|         Diff          |           找出T类型中，与U类型不相同的属性            |\n|   EnhancedRequired    |          增强的必选,可以指定哪些key需要必选           |\n|        Equals         |                  判断2个类型是否相等                  |\n|        Exclude        |        从联合类型T中排除与联合类型U相同的部分         |\n|        Extract        |        从联合类型T中获取与联合类型U相同的部分         |\n|     GetComplement     |          获取联合类型T与其子类型中不同的部分          |\n|     GetDifference     |          获取联合类型T与联合类型U不同的类型           |\n|    GetIntersection    |          获取联合类型T与联合类型U的交叉类型           |\n|     InstanceType      |             获取一个构造函数的实例的类型              |\n|     Intersection      |           取出T中的属性，此属性同样存在于U            |\n|         Merge         |                   合并类型T与类型U                    |\n|  MutableFunctionKeys  | 获取一个类型中，属性为可选同时属性值的类型为函数的key |\n|      MutableKeys      |                 返回非readonly的类型                  |\n|      NonFunction      |       取出没有包含函数类型的参数组成一个新类型        |\n|    NonFunctionKeys    |         取出没有包含函数类型的参数的联合类型          |\n|      NonNullable      |               从联合类型T中排除null类型               |\n|  NonNullAndUndefined  |         去除联合类型T中的undefined和null类型          |\n|     NonUndefined      |            去除联合类型T中的undefined类型             |\n|         Omit          |           从类型T中，排除联合类型U中的属性            |\n|      OmitByValue      |              通过属性值的类型来排除属性               |\n|   OmitByValueExact    |            通过属性值的类型来精确排除属性             |\n|       Optional        |                 可配置的设置可选属性                  |\n|     OptionalKeys      |                   取出所有可选的key                   |\n|       OverWrite       |                   取出所有可选的key                   |\n|      Parameters       |          获取一个函数类型中，参数的元祖类型           |\n|        Partial        |                将T中的所有属性变为可选                |\n|         Pick          |     从类型T中获取一组，以联合类型K为基础的新类型      |\n|      PickByValue      |                  通过类型值获取类型                   |\n|          Pop          |               删除元祖中的最后一个类型                |\n|       Primitive       |                        原始值                         |\n|      PromiseType      |             获取Promise的resolve的值类型              |\n|       Readonly        |            将T中所有的属性，转变为readonly            |\n|     ReadonlyKeys      |                  获取readonly的类型                   |\n|        Record         |    返回以联合类型K为属性，以T为属性值类型的新类型     |\n|        Replace        |                 替换类型中一部分内容                  |\n|       Required        |                将T中的所有类型变为必选                |\n|     RequiredKeys      |                   取出所有必须的key                   |\n|      ReturnType       |              获取函数类型中,返回值的类型              |\n|         Shift         |                删除元祖中的第一个类型                 |\n|       Subtract        |                   获取子集中的差异                    |\n|  SymmetricDifference  |          获取T类型中与U类型两者中不同的部分           |\n|         Trim          |                 去除字符串两边的空格                  |\n|       TrimLeft        |                 去除字符串左边的空格                  |\n|       TrimRight       |                 去除字符串右边的空格                  |\n|       Unionize        |                 将类型T拆解为联合类型                 |\n|  UnionToIntersection  |                  联合类型转交叉类型                   |\n|      ValuesType       |    获取对象、数组、类数组中的值的类型组成联合类型     |\n|     GetArrayValue     |                  获取数组元素的类型                   |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-void0%2Ft2t-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomas-void0%2Ft2t-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-void0%2Ft2t-tools/lists"}