{"id":16451771,"url":"https://github.com/thebearingedge/type-diff","last_synced_at":"2026-05-15T09:35:07.476Z","repository":{"id":57383172,"uuid":"64553559","full_name":"thebearingedge/type-diff","owner":"thebearingedge","description":"Simple, readable, structural type comparisons.","archived":false,"fork":false,"pushed_at":"2020-07-19T22:37:48.000Z","size":166,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T21:06:06.027Z","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/thebearingedge.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":"2016-07-30T16:31:49.000Z","updated_at":"2020-07-19T22:37:51.000Z","dependencies_parsed_at":"2022-09-26T16:50:20.853Z","dependency_job_id":null,"html_url":"https://github.com/thebearingedge/type-diff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebearingedge%2Ftype-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebearingedge%2Ftype-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebearingedge%2Ftype-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thebearingedge%2Ftype-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thebearingedge","download_url":"https://codeload.github.com/thebearingedge/type-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240888021,"owners_count":19873591,"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-10-11T10:10:19.511Z","updated_at":"2026-05-15T09:35:02.431Z","avatar_url":"https://github.com/thebearingedge.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"type-diff\n--\nSimple, readable, structural type comparisons.\n\n[![Build Status](https://travis-ci.org/thebearingedge/type-diff.svg?branch=master)](https://travis-ci.org/thebearingedge/type-diff)\n[![Coverage Status](https://coveralls.io/repos/github/thebearingedge/type-diff/badge.svg?branch=master)](https://coveralls.io/github/thebearingedge/type-diff?branch=master)\n[![Greenkeeper badge](https://badges.greenkeeper.io/thebearingedge/type-diff.svg)](https://greenkeeper.io/)\n[![dependencies Status](https://david-dm.org/thebearingedge/type-diff/status.svg)](https://david-dm.org/thebearingedge/type-diff)\n[![devDependencies Status](https://david-dm.org/thebearingedge/type-diff/dev-status.svg)](https://david-dm.org/thebearingedge/type-diff?type=dev)\n\n### Quick Example\n\n```js\nimport assert from 'assert'\nimport { diff, Nullable, Optional, Any } from 'type-diff'\n\nconst Type = {\n  id: Number,\n  tags: [String]\n  contacts: [{\n    id: Number,\n    name: String,\n    contacted: Nullable(Date),\n    tags: Optional([String]),\n    wharrgarbl: Any()\n  }]\n}\n\nconst value = {\n  id: 1,\n  tags: ['good', 'cool'],\n  contacts: [\n    { id: 2, name: 'John Doe', contacted: null, wharrgarbl: _ =\u003e 'wheee' },\n    { id: '3', name: 'Jane Doe', contacted: new Date(), tags: ['cool'] }\n  ]\n}\n\nassert.deepEqual(diff(Type, value), {\n  contacts: {\n    '1': {\n      id: {\n        actual: 'String',\n        expected: 'Number',\n        value: '3'\n      },\n      wharrgarbl: {\n        actual: 'Undefined',\n        expected: 'Any'\n      }\n    }\n  }\n})\n```\n### Usage\n\n`diff(Type, value)`\n\nGenerate an object literal representation of the difference between your `Type` and a given `value` as shown above in the [Quick Example](#quick-example).\n\n### Supported Built-ins\n\n- `Number`\n- `String`\n- `Boolean`\n- `Object`\n- `Array`\n- `Date`\n- `Function`\n\n### Helpers\n\n`Nullable(Type)`: Allows the corresponding `value` to be either the correct `Type` or `null`.\n\n`Optional(Type)`: Allows the corresponding `value` to be either the correct `Type` or `undefined`.\n\n`Any | Any()`: Requires that the corresponding value be anything but `undefined`. Used in conjuction with `Optional` if `undefined` is allowed; as in `Optional(Any)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebearingedge%2Ftype-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthebearingedge%2Ftype-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthebearingedge%2Ftype-diff/lists"}