{"id":13452487,"url":"https://github.com/sindresorhus/type-fest","last_synced_at":"2026-01-31T13:17:23.503Z","repository":{"id":37359679,"uuid":"175398594","full_name":"sindresorhus/type-fest","owner":"sindresorhus","description":"A collection of essential TypeScript types","archived":false,"fork":false,"pushed_at":"2025-12-08T13:46:17.000Z","size":2902,"stargazers_count":16595,"open_issues_count":203,"forks_count":660,"subscribers_count":53,"default_branch":"main","last_synced_at":"2025-12-10T07:28:16.484Z","etag":null,"topics":["npm-package","types","typescript","typescript-definitions","utilities"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":".github/contributing.md","funding":".github/funding.yml","license":"license-cc0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2019-03-13T10:30:19.000Z","updated_at":"2025-12-10T03:01:17.000Z","dependencies_parsed_at":"2024-02-08T19:22:29.128Z","dependency_job_id":"d627031c-f952-46c4-b2cd-acccd377339f","html_url":"https://github.com/sindresorhus/type-fest","commit_stats":{"total_commits":646,"total_committers":175,"mean_commits":"3.6914285714285713","dds":0.5572755417956656,"last_synced_commit":"cace1f273358882f1cbcbc883d0d2497f0f1a494"},"previous_names":[],"tags_count":183,"template":false,"template_full_name":null,"purl":"pkg:github/sindresorhus/type-fest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftype-fest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftype-fest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftype-fest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftype-fest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/type-fest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftype-fest/sbom","scorecard":{"id":766213,"data":{"date":"2025-08-11","repo":{"name":"github.com/sindresorhus/type-fest","commit":"b5b02143f6dd1bcab11e2094a47d1510d57c3498"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":9,"reason":"Found 28/30 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: .github/security.md:1","Info: Found linked content: .github/security.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/security.md:1","Info: Found text in security policy: .github/security.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/ts-canary.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 15 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ts-canary.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/ts-canary.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ts-canary.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/type-fest/ts-canary.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:44","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:45","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:55","Warn: npmCommand not pinned by hash: .github/workflows/main.yml:28","Warn: npmCommand not pinned by hash: .github/workflows/ts-canary.yml:23","Warn: npmCommand not pinned by hash: .github/workflows/ts-canary.yml:24","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license-cc0:0","Info: FSF or OSI recognized license: Creative Commons Zero v1.0 Universal: license-cc0:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T00:53:34.007Z","repository_id":37359679,"created_at":"2025-08-23T00:53:34.008Z","updated_at":"2025-08-23T00:53:34.008Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27638235,"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-12-10T02:00:12.818Z","response_time":54,"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":["npm-package","types","typescript","typescript-definitions","utilities"],"created_at":"2024-07-31T07:01:25.580Z","updated_at":"2026-01-16T10:53:04.377Z","avatar_url":"https://github.com/sindresorhus.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["TypeScript","Uncategorized","**1. Libraries**","Typescript / Javascript","Underlying Technologies","基础设施","Credits","目录","🔧 Utilities \u0026 Miscellaneous","typescript","node.js/javascript","Packages","Types",":books: Libraries"],"sub_categories":["Uncategorized","Others","TypeScript","JAM Stack/静态站点","React","Open Source","collection","IDE","Server-rendered React","Universal"],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cimg src=\"media/logo.svg\" alt=\"type-fest\" height=\"300\"\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cb\u003eA collection of essential TypeScript types\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003cbr\u003e\n\t\u003chr\u003e\n\t\u003cdiv align=\"center\"\u003e\n\t\t\u003cp\u003e\n\t\t\t\u003cp\u003e\n\t\t\t\t\u003csup\u003e\n\t\t\t\t\t\u003ca href=\"https://github.com/sponsors/sindresorhus\"\u003eSindre Sorhus' open source work is supported by the community\u003c/a\u003e\n\t\t\t\t\u003c/sup\u003e\n\t\t\t\u003c/p\u003e\n\t\t\t\u003csup\u003eSpecial thanks to:\u003c/sup\u003e\n\t\t\t\u003cbr\u003e\n\t\t\t\u003cbr\u003e\n\t\t\t\u003ca href=\"https://nitric.io/?utm_campaign=github_repo\u0026utm_medium=referral\u0026utm_content=sindresorhus\u0026utm_source=github\"\u003e\n\t\t\t\t\u003cdiv\u003e\n\t\t\t\t\t\u003cimg width=\"230\" src=\"https://sindresorhus.com/assets/thanks/nitric-logo.svg\" alt=\"nitric logo\"\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\t\u003cb\u003eEffortless backends with infrastructure from code\u003c/b\u003e\n\t\t\t\t\u003cdiv\u003e\n\t\t\t\t\t\u003csup\u003eAn open-source framework that supports any programming language, cloud provider, or deployment automation tool.\u003c/sup\u003e\n\t\t\t\t\u003c/div\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/p\u003e\n\t\u003c/div\u003e\n\t\u003cbr\u003e\n\t\u003chr\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n[![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)\n[![npm dependents](https://badgen.net/npm/dependents/type-fest)](https://www.npmjs.com/package/type-fest?activeTab=dependents)\n[![npm downloads](https://badgen.net/npm/dt/type-fest)](https://www.npmjs.com/package/type-fest)\n\nMany of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/main/CONTRIBUTING.md).\n\nEither add this package as a dependency or copy-paste the needed types. No credit required. 👌\n\nPR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.\n\n**Help wanted with reviewing [proposals](https://github.com/sindresorhus/type-fest/issues) and [pull requests](https://github.com/sindresorhus/type-fest/pulls).**\n\n## Install\n\n```sh\nnpm install type-fest\n```\n\n*Requires TypeScript \u003e=5.9, [ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), and [`{strict: true}`](https://www.typescriptlang.org/tsconfig#strict) in your tsconfig.*\n\n\u003e [!NOTE]\n\u003e This readme shows the current development version. For docs about the latest version, see the [npm page](https://www.npmjs.com/package/type-fest).\n\n*You may also like my [`ts-extras`](https://github.com/sindresorhus/ts-extras) package which provides runtime functions for some of these types.*\n\n## Usage\n\n```ts\nimport type {Except} from 'type-fest';\n\ntype Foo = {\n\tunicorn: string;\n\trainbow: boolean;\n};\n\ntype FooWithoutRainbow = Except\u003cFoo, 'rainbow'\u003e;\n//=\u003e {unicorn: string}\n```\n\n## API\n\nClick the type names for complete docs.\n\n### Basic\n\n- [`Primitive`](source/primitive.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).\n- [`Class`](source/basic.d.ts) - Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n- [`Constructor`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n- [`AbstractClass`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/2/classes.html#abstract-classes-and-members).\n- [`AbstractConstructor`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n- [`TypedArray`](source/typed-array.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.\n- [`ObservableLike`](source/globals/observable-like.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).\n- [`LowercaseLetter`](source/characters.d.ts) - Matches any lowercase letter in the basic Latin alphabet (a-z).\n- [`UppercaseLetter`](source/characters.d.ts) - Matches any uppercase letter in the basic Latin alphabet (A-Z).\n- [`DigitCharacter`](source/characters.d.ts) - Matches any digit as a string ('0'-'9').\n- [`Alphanumeric`](source/characters.d.ts) - Matches any lowercase letter (a-z), uppercase letter (A-Z), or digit ('0'-'9') in the basic Latin alphabet.\n\n### Utilities\n\n- [`EmptyObject`](source/empty-object.d.ts) - Represents a strictly empty plain object, the `{}` value.\n- [`NonEmptyObject`](source/non-empty-object.d.ts) - Represents an object with at least 1 non-optional key.\n- [`UnknownRecord`](source/unknown-record.d.ts) - Represents an object with `unknown` value. You probably want this instead of `{}`.\n- [`UnknownArray`](source/unknown-array.d.ts) - Represents an array with `unknown` value.\n- [`UnknownMap`](source/unknown-map.d.ts) - Represents a map with `unknown` key and value.\n- [`UnknownSet`](source/unknown-set.d.ts) - Represents a set with `unknown` value.\n- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys).\n- [`Writable`](source/writable.d.ts) - Create a type that strips `readonly` from the given type. Inverse of `Readonly\u003cT\u003e`.\n- [`WritableDeep`](source/writable-deep.d.ts) - Create a deeply mutable version of an `object`/`ReadonlyMap`/`ReadonlySet`/`ReadonlyArray` type. The inverse of `ReadonlyDeep\u003cT\u003e`. Use `Writable\u003cT\u003e` if you only need one level deep.\n- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.\n- [`ObjectMerge`](source/object-merge.d.ts) - Merge two object types into a new object type, where keys from the second override keys from the first.\n- [`MergeDeep`](source/merge-deep.d.ts) - Merge two objects or two arrays/tuples recursively into a new type.\n- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.\n- [`OverrideProperties`](source/override-properties.d.ts) - Override only existing properties of the given type. Similar to `Merge`, but enforces that the original type has the properties you want to override.\n- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.\n- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.\n- [`RequireAllOrNone`](source/require-all-or-none.d.ts) - Create a type that requires all of the given keys or none of the given keys.\n- [`RequireOneOrNone`](source/require-one-or-none.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more, or none of the given keys.\n- [`SingleKeyObject`](source/single-key-object.d.ts) - Create a type that only accepts an object with a single key.\n- [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type. Use [`Required\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) if you only need one level deep.\n- [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object. Use [`Pick\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) if you only need one level deep.\n- [`OmitDeep`](source/omit-deep.d.ts) - Omit properties from a deeply-nested object. Use [`Omit\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) if you only need one level deep.\n- [`OmitIndexSignature`](source/omit-index-signature.d.ts) - Omit any index signatures from the given object type, leaving only explicitly defined properties.\n- [`PickIndexSignature`](source/pick-index-signature.d.ts) - Pick only index signatures from the given object type, leaving out all explicitly defined properties.\n- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) if you only need one level deep.\n- [`PartialOnUndefinedDeep`](source/partial-on-undefined-deep.d.ts) - Create a deep version of another type where all keys accepting `undefined` type are set to optional.\n- [`UndefinedOnPartialDeep`](source/undefined-on-partial-deep.d.ts) - Create a deep version of another type where all optional keys are set to also accept `undefined`.\n- [`UnwrapPartial`](source/unwrap-partial.d.ts) - Revert the `Partial` modifier on an object type.\n- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep.\n- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).\n- [`Tagged`](source/tagged.d.ts) - Create a [tagged type](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d) that can support [multiple tags](https://github.com/sindresorhus/type-fest/issues/665) and [per-tag metadata](https://medium.com/@ethanresnick/advanced-typescript-tagged-types-improved-with-type-level-metadata-5072fc125fcf). (This replaces the previous [`Opaque`](source/tagged.d.ts) type, which is now deprecated.)\n- [`UnwrapTagged`](source/tagged.d.ts) - Get the untagged portion of a tagged type created with `Tagged`. (This replaces the previous [`UnwrapOpaque`](source/tagged.d.ts) type, which is now deprecated.)\n- [`InvariantOf`](source/invariant-of.d.ts) - Create an [invariant type](https://basarat.gitbook.io/typescript/type-system/type-compatibility#footnote-invariance), which is a type that does not accept supertypes and subtypes.\n- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.\n- [`SetReadonly`](source/set-readonly.d.ts) - Create a type that makes the given keys readonly.\n- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.\n- [`SetRequiredDeep`](source/set-required-deep.d.ts) - Like `SetRequired` except it selects the keys deeply.\n- [`SetNonNullable`](source/set-non-nullable.d.ts) - Create a type that makes the given keys non-nullable.\n- [`SetNonNullableDeep`](source/set-non-nullable-deep.d.ts) - Create a type that makes the specified keys non-nullable (removes `null` and `undefined`), supports deeply nested key paths, and leaves all other keys unchanged.\n- [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.\n- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.\n- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.\n- [`ConditionalPickDeep`](source/conditional-pick-deep.d.ts) - Like `ConditionalPick` except that it selects the properties deeply.\n- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.\n- [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.\n- [`LiteralToPrimitive`](source/literal-to-primitive.d.ts) - Convert a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types) to the [primitive type](source/primitive.d.ts) it belongs to.\n- [`LiteralToPrimitiveDeep`](source/literal-to-primitive-deep.d.ts) - Like `LiteralToPrimitive` except it converts literal types inside an object or array deeply.\n- [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.\n- [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, `Array`, `Set`, `Map`, generator, stream, etc.\n- [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.\n- [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.\n- [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.\n- [`SetParameterType`](source/set-parameter-type.d.ts) - Create a function that replaces some parameters with the given parameters.\n- [`Simplify`](source/simplify.d.ts) - Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n- [`SimplifyDeep`](source/simplify-deep.d.ts) - Deeply simplifies an object type.\n- [`Get`](source/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.\n- [`KeyAsString`](source/key-as-string.d.ts) - Get keys of the given type as strings.\n- [`Schema`](source/schema.d.ts) - Create a deep version of another object type where property values are recursively replaced into a given value type.\n- [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties.\n- [`KeysOfUnion`](source/keys-of-union.d.ts) - Create a union of all keys from a given type, even those exclusive to specific union members.\n- [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.\n- [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any optional fields.\n- [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.\n- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.\n- [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all readonly keys from the given type.\n- [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any readonly fields.\n- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type.\n- [`HasWritableKeys`](source/has-writable-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any writable fields.\n- [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.\n- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.\n- [`TaggedUnion`](source/tagged-union.d.ts) - Create a union of types that share a common discriminant property.\n- [`IntRange`](source/int-range.d.ts) - Generate a union of numbers (includes the start and excludes the end).\n- [`IntClosedRange`](source/int-closed-range.d.ts) - Generate a union of numbers (includes the start and the end).\n- [`ArrayIndices`](source/array-indices.d.ts) - Provides valid indices for a constant array or tuple.\n- [`ArrayValues`](source/array-values.d.ts) - Provides all values for a constant array or tuple.\n- [`ArraySplice`](source/array-splice.d.ts) - Create a new array type by adding or removing elements at a specified index range in the original array.\n- [`ArrayTail`](source/array-tail.d.ts) - Extract the type of an array or tuple minus the first element.\n- [`SetFieldType`](source/set-field-type.d.ts) - Create a type that changes the type of the given keys.\n- [`Paths`](source/paths.d.ts) - Generate a union of all possible paths to properties in the given object.\n- [`SharedUnionFields`](source/shared-union-fields.d.ts) - Create a type with shared fields from a union of object types.\n- [`SharedUnionFieldsDeep`](source/shared-union-fields-deep.d.ts) - Create a type with shared fields from a union of object types, deeply traversing nested structures.\n- [`AllUnionFields`](source/all-union-fields.d.ts) - Create a type with all fields from a union of object types.\n- [`DistributedOmit`](source/distributed-omit.d.ts) - Omits keys from a type, distributing the operation over a union.\n- [`DistributedPick`](source/distributed-pick.d.ts) - Picks keys from a type, distributing the operation over a union.\n- [`And`](source/and.d.ts) - Returns a boolean for whether two given types are both true.\n- [`Or`](source/or.d.ts) - Returns a boolean for whether either of two given types is true.\n- [`Xor`](source/xor.d.ts) - Returns a boolean for whether only one of two given types is true.\n- [`AllExtend`](source/all-extend.d.ts) - Returns a boolean for whether every element in an array type extends another type.\n- [`NonEmptyTuple`](source/non-empty-tuple.d.ts) - Matches any non-empty tuple.\n- [`NonEmptyString`](source/non-empty-string.d.ts) - Matches any non-empty string.\n- [`FindGlobalType`](source/find-global-type.d.ts) - Tries to find the type of a global with the given name.\n- [`FindGlobalInstanceType`](source/find-global-type.d.ts) - Tries to find one or more types from their globally-defined constructors.\n- [`ConditionalSimplify`](source/conditional-simplify.d.ts) - Simplifies a type while including and/or excluding certain types from being simplified.\n- [`ConditionalSimplifyDeep`](source/conditional-simplify-deep.d.ts) - Recursively simplifies a type while including and/or excluding certain types from being simplified.\n- [`ExclusifyUnion`](source/exclusify-union.d.ts) - Ensure mutual exclusivity in object unions by adding other members’ keys as `?: never`.\n\n### Type Guard\n\n- [`If`](source/if.d.ts) - An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.\n- [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).\n- [`IsAny`](source/is-any.d.ts) - Returns a boolean for whether the given type is `any`.\n- [`IsNever`](source/is-never.d.ts) - Returns a boolean for whether the given type is `never`.\n- [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`.\n- [`IsEmptyObject`](source/empty-object.d.ts) - Returns a boolean for whether the type is strictly equal to an empty plain object, the `{}` value.\n- [`IsNull`](source/is-null.d.ts) - Returns a boolean for whether the given type is `null`.\n- [`IsUndefined`](source/is-undefined.d.ts) - Returns a boolean for whether the given type is `undefined`.\n- [`IsTuple`](source/is-tuple.d.ts) - Returns a boolean for whether the given array is a tuple.\n- [`IsUnion`](source/is-union.d.ts) - Returns a boolean for whether the given type is a union.\n- [`IsLowercase`](source/is-lowercase.d.ts) - Returns a boolean for whether the given string literal is lowercase.\n- [`IsUppercase`](source/is-uppercase.d.ts) - Returns a boolean for whether the given string literal is uppercase.\n- [`IsOptional`](source/is-optional.d.ts) - Returns a boolean for whether the given type includes `undefined`.\n- [`IsNullable`](source/is-nullable.d.ts) - Returns a boolean for whether the given type includes `null`.\n- [`IsOptionalKeyOf`](source/is-optional-key-of.d.ts) - Returns a boolean for whether the given key is an optional key of type.\n- [`IsRequiredKeyOf`](source/is-required-key-of.d.ts) - Returns a boolean for whether the given key is a required key of type.\n- [`IsReadonlyKeyOf`](source/is-readonly-key-of.d.ts) - Returns a boolean for whether the given key is a readonly key of type.\n- [`IsWritableKeyOf`](source/is-writable-key-of.d.ts) - Returns a boolean for whether the given key is a writable key of type.\n\n### JSON\n\n- [`Jsonify`](source/jsonify.d.ts) - Transform a type to one that is assignable to the `JsonValue` type.\n- [`Jsonifiable`](source/jsonifiable.d.ts) - Matches a value that can be losslessly converted to JSON.\n- [`JsonPrimitive`](source/json-value.d.ts) - Matches a JSON primitive.\n- [`JsonObject`](source/json-value.d.ts) - Matches a JSON object.\n- [`JsonArray`](source/json-value.d.ts) - Matches a JSON array.\n- [`JsonValue`](source/json-value.d.ts) - Matches any valid JSON value.\n\n### Structured clone\n\n- [`StructuredCloneable`](source/structured-cloneable.d.ts) - Matches a value that can be losslessly cloned using `structuredClone`.\n\n### Async\n\n- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.\n- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.\n- [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.\n\n### String\n\n- [`Trim`](source/trim.d.ts) - Remove leading and trailing spaces from a string.\n- [`Split`](source/split.d.ts) - Represents an array of strings split using a given character or character set.\n- [`Words`](source/words.d.ts) - Represents an array of strings split using a heuristic for detecting words.\n- [`Replace`](source/replace.d.ts) - Represents a string with some or all matches replaced by a replacement.\n- [`StringSlice`](source/string-slice.d.ts) - Returns a string slice of a given range, just like `String#slice()`.\n- [`StringRepeat`](source/string-repeat.d.ts) - Returns a new string which contains the specified number of copies of a given string, just like `String#repeat()`.\n- [`RemovePrefix`](source/remove-prefix.d.ts) - Remove the specified prefix from the start of a string.\n\n### Array\n\n- [`Arrayable`](source/arrayable.d.ts) - Create a type that represents either the value or an array of the value.\n- [`Includes`](source/includes.d.ts) - Returns a boolean for whether the given array includes the given item.\n- [`Join`](source/join.d.ts) - Join an array of strings and/or numbers using the given string as a delimiter.\n- [`ArraySlice`](source/array-slice.d.ts) - Returns an array slice of a given range, just like `Array#slice()`.\n- [`ArrayElement`](source/array-element.d.ts) - Extracts the element type of an array or tuple.\n- [`LastArrayElement`](source/last-array-element.d.ts) - Extract the type of the last element of an array.\n- [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length. The `Array` prototype methods that manipulate its length are excluded from the resulting type.\n- [`MultidimensionalArray`](source/multidimensional-array.d.ts) - Create a type that represents a multidimensional array of the given type and dimensions.\n- [`MultidimensionalReadonlyArray`](source/multidimensional-readonly-array.d.ts) - Create a type that represents a multidimensional readonly array of the given type and dimensions.\n- [`ReadonlyTuple`](source/readonly-tuple.d.ts) - Create a type that represents a read-only tuple of the given type and length.\n- [`TupleToUnion`](source/tuple-to-union.d.ts) - Convert a tuple/array into a union type of its elements.\n- [`UnionToTuple`](source/union-to-tuple.d.ts) - Convert a union type into an unordered tuple type of its elements.\n- [`TupleToObject`](source/tuple-to-object.d.ts) - Transforms a tuple into an object, mapping each tuple index to its corresponding type as a key-value pair.\n- [`TupleOf`](source/tuple-of.d.ts) - Create a tuple type of the specified length with elements of the specified type.\n- [`SplitOnRestElement`](source/split-on-rest-element.d.ts) - Splits an array into three parts, where the first contains all elements before the rest element, the second is the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element itself, and the third contains all elements after the rest element.\n- [`ExtractRestElement`](source/extract-rest-element.d.ts) - Extract the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element type from an array.\n- [`ExcludeRestElement`](source/exclude-rest-element.d.ts) - Create a tuple with the [`rest`](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) element removed.\n- [`ArrayReverse`](source/array-reverse.d.ts) - Reverse the order of elements in a tuple type.\n\n### Numeric\n\n- [`PositiveInfinity`](source/numeric.d.ts) - Matches the hidden `Infinity` type.\n- [`NegativeInfinity`](source/numeric.d.ts) - Matches the hidden `-Infinity` type.\n- [`Finite`](source/numeric.d.ts) - A finite `number`.\n- [`Integer`](source/numeric.d.ts) - A `number` that is an integer.\n- [`Float`](source/numeric.d.ts) - A `number` that is not an integer.\n- [`NegativeFloat`](source/numeric.d.ts) - A negative (`-∞ \u003c x \u003c 0`) `number` that is not an integer.\n- [`Negative`](source/numeric.d.ts) - A negative `number`/`bigint` (`-∞ \u003c x \u003c 0`)\n- [`NonNegative`](source/numeric.d.ts) - A non-negative `number`/`bigint` (`0 \u003c= x \u003c ∞`).\n- [`NegativeInteger`](source/numeric.d.ts) - A negative (`-∞ \u003c x \u003c 0`) `number` that is an integer.\n- [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 \u003c= x \u003c ∞`) `number` that is an integer.\n- [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number.\n- [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`.\n- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is a integer, like `-5`, `1.0` or `100`.\n- [`GreaterThan`](source/greater-than.d.ts) - Returns a boolean for whether a given number is greater than another number.\n- [`GreaterThanOrEqual`](source/greater-than-or-equal.d.ts) - Returns a boolean for whether a given number is greater than or equal to another number.\n- [`LessThan`](source/less-than.d.ts) - Returns a boolean for whether a given number is less than another number.\n- [`LessThanOrEqual`](source/less-than-or-equal.d.ts) - Returns a boolean for whether a given number is less than or equal to another number.\n- [`Sum`](source/sum.d.ts) - Returns the sum of two numbers.\n- [`Subtract`](source/subtract.d.ts) - Returns the difference between two numbers.\n\n### Change case\n\n- [`CamelCase`](source/camel-case.d.ts) - Convert a string literal to camel-case (`fooBar`).\n- [`CamelCasedProperties`](source/camel-cased-properties.d.ts) - Convert object properties to camel-case (`fooBar`).\n- [`CamelCasedPropertiesDeep`](source/camel-cased-properties-deep.d.ts) - Convert object properties to camel-case recursively (`fooBar`).\n- [`KebabCase`](source/kebab-case.d.ts) - Convert a string literal to kebab-case (`foo-bar`).\n- [`KebabCasedProperties`](source/kebab-cased-properties.d.ts) - Convert object properties to kebab-case (`foo-bar`).\n- [`KebabCasedPropertiesDeep`](source/kebab-cased-properties-deep.d.ts) - Convert object properties to kebab-case recursively (`foo-bar`).\n- [`PascalCase`](source/pascal-case.d.ts) - Convert a string literal to pascal-case (`FooBar`).\n- [`PascalCasedProperties`](source/pascal-cased-properties.d.ts) - Convert object properties to pascal-case (`FooBar`).\n- [`PascalCasedPropertiesDeep`](source/pascal-cased-properties-deep.d.ts) - Convert object properties to pascal-case recursively (`FooBar`).\n- [`SnakeCase`](source/snake-case.d.ts) - Convert a string literal to snake-case (`foo_bar`).\n- [`SnakeCasedProperties`](source/snake-cased-properties.d.ts) - Convert object properties to snake-case (`foo_bar`).\n- [`SnakeCasedPropertiesDeep`](source/snake-cased-properties-deep.d.ts) - Convert object properties to snake-case recursively (`foo_bar`).\n- [`ScreamingSnakeCase`](source/screaming-snake-case.d.ts) - Convert a string literal to screaming-snake-case (`FOO_BAR`).\n- [`DelimiterCase`](source/delimiter-case.d.ts) - Convert a string literal to a custom string delimiter casing.\n- [`DelimiterCasedProperties`](source/delimiter-cased-properties.d.ts) - Convert object properties to a custom string delimiter casing.\n- [`DelimiterCasedPropertiesDeep`](source/delimiter-cased-properties-deep.d.ts) - Convert object properties to a custom string delimiter casing recursively.\n\n### Miscellaneous\n\n- [`GlobalThis`](source/global-this.d.ts) - Declare locally scoped properties on `globalThis`.\n- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). It also includes support for [TypeScript Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html).\n- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).\n\n### Improved built-in\n\n- [`ExtendsStrict`](source/extends-strict.d.ts) - A stricter, non-distributive version of `extends` for checking whether one type is assignable to another.\n- [`ExtractStrict`](source/extract-strict.d.ts) - A stricter version of `Extract\u003cT, U\u003e` that ensures every member of `U` can successfully extract something from `T`.\n- [`ExcludeStrict`](source/exclude-strict.d.ts) - A stricter version of `Exclude\u003cT, U\u003e` that ensures every member of `U` can successfully exclude something from `T`.\n\n## Declined types\n\n*If we decline a type addition, we will make sure to document the better solution here.*\n\n- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The pull request author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.\n- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary\u003cnumber\u003e` vs `Record\u003cstring, number\u003e`) from [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.\n- [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.\n- [`Url2Json`](https://github.com/sindresorhus/type-fest/pull/262) - Inferring search parameters from a URL string is a cute idea, but not very useful in practice, since search parameters are usually dynamic and defined separately.\n- [`Nullish`](https://github.com/sindresorhus/type-fest/pull/318) - The type only saves a couple of characters, not everyone knows what \"nullish\" means, and I'm also trying to [get away from `null`](https://github.com/sindresorhus/meta/discussions/7).\n- [`TitleCase`](https://github.com/sindresorhus/type-fest/pull/303) - It's not solving a common need and is a better fit for a separate package.\n- [`ExtendOr` and `ExtendAnd`](https://github.com/sindresorhus/type-fest/pull/247) - The benefits don't outweigh having to learn what they mean.\n- [`PackageJsonExtras`](https://github.com/sindresorhus/type-fest/issues/371) - There are too many possible configurations that can be put into `package.json`. If you would like to extend `PackageJson` to support an additional configuration in your project, please see the *Extending existing types* section below.\n\n## Alternative type names\n\n*If you know one of our types by a different name, add it here for discovery.*\n\n- `Prettify`- See [`Simplify`](source/simplify.d.ts)\n- `Expand`- See [`Simplify`](source/simplify.d.ts)\n- `PartialBy` - See [`SetOptional`](source/set-optional.d.ts)\n- `RecordDeep`- See [`Schema`](source/schema.d.ts)\n- `Mutable`- See [`Writable`](source/writable.d.ts)\n- `RequireOnlyOne`, `OneOf` - See [`RequireExactlyOne`](source/require-exactly-one.d.ts)\n- `AtMostOne` - See [`RequireOneOrNone`](source/require-one-or-none.d.ts)\n- `AllKeys` - See [`KeysOfUnion`](source/keys-of-union.d.ts)\n- `Branded` - See [`Tagged`](source/tagged.d.ts)\n- `Opaque` - See [`Tagged`](source/tagged.d.ts)\n- `SetElement` - See [`IterableElement`](source/iterable-element.d.ts)\n- `SetEntry` - See [`IterableElement`](source/iterable-element.d.ts)\n- `SetValues` - See [`IterableElement`](source/iterable-element.d.ts)\n- `PickByTypes` - See [`ConditionalPick`](source/conditional-pick.d.ts)\n- `HomomorphicOmit` - See [`Except`](source/except.d.ts)\n- `IfAny`, `IfNever`, `If*` - See [`If`](source/if.d.ts)\n- `MaybePromise` - See [`Promisable`](source/promisable.d.ts)\n- `ReadonlyTuple` - See [`TupleOf`](source/tuple-of.d.ts)\n\n## Tips\n\n### Extending existing types\n\n- [`PackageJson`](source/package-json.d.ts) - There are a lot of tools that place extra configurations inside the `package.json` file. You can extend `PackageJson` to support these additional configurations.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBDAnmApnA3gBQIYGMDW2A5igFIDOEAdnNuXAEJ0o4HFmVUC+cAZlBBBwA5ElQBaXinIxhAbgCwAKFCRYCZGnQAZYFRgooPfoJHSANntmKlysWlaESFanAC8jZo-YuaAMgwLKwBhal5gIgB+AC44XX1DADpQqnCiLhsgA)\n\n\t```ts\n\timport type {PackageJson as BasePackageJson} from 'type-fest';\n\timport type {Linter} from 'eslint';\n\n\ttype PackageJson = BasePackageJson \u0026 {eslintConfig?: Linter.Config};\n\t```\n\t\u003c/details\u003e\n\n### Related\n\n- [typed-query-selector](https://github.com/g-plane/typed-query-selector) - Enhances `document.querySelector` and `document.querySelectorAll` with a template literal type that matches element types returned from an HTML element query selector.\n- [`Linter.Config`](https://github.com/eslint/eslint/blob/main/lib/types/index.d.ts) - Definitions for the [ESLint configuration schema](https://eslint.org/docs/user-guide/configuring/language-options).\n\n### Built-in types\n\nThere are many advanced types most users don't know about.\n\n\n- [`Awaited\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#awaitedtype) - Extract the type of a value that a `Promise` resolves to.\n  \u003cdetails\u003e\n  \u003csummary\u003e\n  \tExample\n  \u003c/summary\u003e\n\n  [Playground](https://www.typescriptlang.org/play/?#code/JYOwLgpgTgZghgYwgAgKoGdrIN4FgBQyyAkMACYBcyIArgLYBG0A3AUcSHHRFemFKADmrQiTiCe1ekygiiAXwJtkCADZx06NJigBBAA7AAytABuwJDmXENATxAJkMCGAQALDNAAUNHQElKKUZoAEoqAAUoAHs6YEwAHk8oAD4rUWJiAHpM5AAxF3dkMDcUXywyODA4J2i6IpLkCqqGDQgAOmssnIAVBsQwGjhVZGA6fVUIbnBK4CiQZFjBNzBkVSiogGtV4A2UYriKTuyVOb5kKAh0fVOUAF5kOAB3OGAV51c3LwAiTLhDTLKUEyABJsICAvIQnISF0TiAzk1qvcLlcbm0AFboOZeKFHHIXAZQeaI6EZAk0Ik4EaBACMABpqFxJF8AFJRNzzAAiUQgXwZ4kkAGYAAzIeSkxSiSXKMC2fQofIfCBkJLIe66Z6vZXxABKLgpIG6cogiR0BmMZgsEAA2l93u4kl8ALrJZIiZR2BxOGgOMCzeZuOAgMgTJKcypwLx-C1QcxIKhJc0mWNWhngwK0YJQEJpdj8Wy5mEIU4rQFURXuZWq+5PF4raPJuPte0eHQ+fxkXHpWG6GCQKBOApuITIQGNCMM2xRGgqIPIeWwKJQOqmOACadafr+rToGiFDSj-RNEfFUo6EbgaDwJB0vGz9wnhqImpRb2Es8QBlLhZwDYjuBkGQrz+kMyC6OEfjnBAACONCXGAm5aCAEDKsqHTpPIs4fMgXjQNE2aFhkxx4d+gbBqoQjWJKChKKIxbwqWZqGI2VpqtQECPNo0BJpaSA4tCZEhhAYYRu23HMbxn7IDSUJAA)\n\n  ```ts\n  interface User {\n  \tid: number;\n  \tname: string;\n  \tage: number;\n  }\n\n  class UserApiService {\n  \tasync fetchUser(userId: number): Promise\u003cUser\u003e {\n  \t\t// Fetch the user data from the database.\n  \t\t// The actual implementation might look like this:\n  \t\t// const response = await fetch('/api/user/${userId}');\n  \t\t// const data = response.json();\n  \t\t// return data;\n  \t\treturn {\n  \t\t\tid: 1,\n  \t\t\tname: 'John Doe',\n  \t\t\tage: 30\n  \t\t};\n  \t}\n  }\n\n  type FetchedUser = Awaited\u003cReturnType\u003cUserApiService['fetchUser']\u003e\u003e;\n\n  async function handleUserData(apiService: UserApiService, userId: number) {\n  \ttry {\n  \t\tconst user: FetchedUser = await apiService.fetchUser(userId);\n  \t\t// After fetching user data, you can perform various actions such as updating the user interface,\n  \t\t// caching the data for future use, or making additional API requests as needed.\n  \t} catch (error) {\n  \t\t// Error handling\n  \t}\n  }\n\n  const userApiService = new UserApiService();\n  handleUserData(userApiService, 1);\n  ```\n\n- [`Partial\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) - Make all properties in `T` optional.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)\n\n\t```ts\n\tinterface NodeConfig {\n\t\t\tappName: string;\n\t\t\tport: number;\n\t}\n\n\tclass NodeAppBuilder {\n\t\t\tprivate configuration: NodeConfig = {\n\t\t\t\t\tappName: 'NodeApp',\n\t\t\t\t\tport: 3000\n\t\t\t};\n\n\t\t\tprivate updateConfig\u003cKey extends keyof NodeConfig\u003e(key: Key, value: NodeConfig[Key]) {\n\t\t\t\t\tthis.configuration[key] = value;\n\t\t\t}\n\n\t\t\tconfig(config: Partial\u003cNodeConfig\u003e) {\n\t\t\t\t\ttype NodeConfigKey = keyof NodeConfig;\n\n\t\t\t\t\tfor (const key of Object.keys(config) as NodeConfigKey[]) {\n\t\t\t\t\t\t\tconst updateValue = config[key];\n\n\t\t\t\t\t\t\tif (updateValue === undefined) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis.updateConfig(key, updateValue);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\t\t\t}\n\t}\n\n\t// `Partial\u003cNodeConfig\u003e`` allows us to provide only a part of the\n\t// NodeConfig interface.\n\tnew NodeAppBuilder().config({appName: 'ToDoApp'});\n\t```\n\n\t`Partial\u003cT\u003e` can be reverted with [`UnwrapPartial`](source/unwrap-partial.d.ts).\n\t\u003c/details\u003e\n\n- [`Required\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) - Make all properties in `T` required.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)\n\n\t```ts\n\tinterface ContactForm {\n\t\t\temail?: string;\n\t\t\tmessage?: string;\n\t}\n\n\tfunction submitContactForm(formData: Required\u003cContactForm\u003e) {\n\t\t\t// Send the form data to the server.\n\t}\n\n\tsubmitContactForm({\n\t\t\temail: 'ex@mple.com',\n\t\t\tmessage: 'Hi! Could you tell me more about…',\n\t});\n\n\t// TypeScript error: missing property 'message'\n\tsubmitContactForm({\n\t\t\temail: 'ex@mple.com',\n\t});\n\t```\n\t\u003c/details\u003e\n\n- [`Readonly\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) - Make all properties in `T` readonly.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)\n\n\t```ts\n\tenum LogLevel {\n\t\t\tOff,\n\t\t\tDebug,\n\t\t\tError,\n\t\t\tFatal\n\t};\n\n\tinterface LoggerConfig {\n\t\t\tname: string;\n\t\t\tlevel: LogLevel;\n\t}\n\n\tclass Logger {\n\t\t\tconfig: Readonly\u003cLoggerConfig\u003e;\n\n\t\t\tconstructor({name, level}: LoggerConfig) {\n\t\t\t\t\tthis.config = {name, level};\n\t\t\t\t\tObject.freeze(this.config);\n\t\t\t}\n\t}\n\n\tconst config: LoggerConfig = {\n\t\tname: 'MyApp',\n\t\tlevel: LogLevel.Debug\n\t};\n\n\tconst logger = new Logger(config);\n\n\t// TypeScript Error: cannot assign to read-only property.\n\tlogger.config.level = LogLevel.Error;\n\n\t// We are able to edit config variable as we please.\n\tconfig.level = LogLevel.Error;\n\t```\n\t\u003c/details\u003e\n\n- [`Pick\u003cT, K\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) - From `T`, pick a set of properties whose keys are in the union `K`.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)\n\n\t```ts\n\tinterface Article {\n\t\t\ttitle: string;\n\t\t\tthumbnail: string;\n\t\t\tcontent: string;\n\t}\n\n\t// Creates new type out of the `Article` interface composed\n\t// from the Articles' two properties: `title` and `thumbnail`.\n\t// `ArticlePreview = {title: string; thumbnail: string}`\n\ttype ArticlePreview = Pick\u003cArticle, 'title' | 'thumbnail'\u003e;\n\n\t// Render a list of articles using only title and description.\n\tfunction renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {\n\t\t\tconst articles = document.createElement('div');\n\n\t\t\tfor (const preview of previews) {\n\t\t\t\t\t// Append preview to the articles.\n\t\t\t}\n\n\t\t\treturn articles;\n\t}\n\n\tconst articles = renderArticlePreviews([\n\t\t\t{\n\t\t\t\ttitle: 'TypeScript tutorial!',\n\t\t\t\tthumbnail: '/assets/ts.jpg'\n\t\t\t}\n\t]);\n\t```\n\t\u003c/details\u003e\n\n- [`Record\u003cK, T\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type) - Construct a type with a set of properties `K` of type `T`.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)\n\n\t```ts\n\t// Positions of employees in our company.\n\ttype MemberPosition = 'intern' | 'developer' | 'tech-lead';\n\n\t// Interface describing properties of a single employee.\n\tinterface Employee {\n\t\t\tfirstName: string;\n\t\t\tlastName: string;\n\t\t\tyearsOfExperience: number;\n\t}\n\n\t// Create an object that has all possible `MemberPosition` values set as keys.\n\t// Those keys will store a collection of Employees of the same position.\n\tconst team: Record\u003cMemberPosition, Employee[]\u003e = {\n\t\t\tintern: [],\n\t\t\tdeveloper: [],\n\t\t\t'tech-lead': [],\n\t};\n\n\t// Our team has decided to help John with his dream of becoming Software Developer.\n\tteam.intern.push({\n\t\tfirstName: 'John',\n\t\tlastName: 'Doe',\n\t\tyearsOfExperience: 0\n\t});\n\n\t// `Record` forces you to initialize all of the property keys.\n\t// TypeScript Error: \"tech-lead\" property is missing\n\tconst teamEmpty: Record\u003cMemberPosition, null\u003e = {\n\t\t\tintern: null,\n\t\t\tdeveloper: null,\n\t};\n\t```\n\t\u003c/details\u003e\n\n- [`Exclude\u003cT, U\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#excludetype-excludedunion) - Exclude from `T` those types that are assignable to `U`.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)\n\n\t```ts\n\tinterface ServerConfig {\n\t\tport: null | string | number;\n\t}\n\n\ttype RequestHandler = (request: Request, response: Response) =\u003e void;\n\n\t// Exclude `null` type from `null | string | number`.\n\t// In case the port is equal to `null`, we will use default value.\n\tfunction getPortValue(port: Exclude\u003cServerConfig['port'], null\u003e): number {\n\t\tif (typeof port === 'string') {\n\t\t\treturn parseInt(port, 10);\n\t\t}\n\n\t\treturn port;\n\t}\n\n\tfunction startServer(handler: RequestHandler, config: ServerConfig): void {\n\t\tconst server = require('http').createServer(handler);\n\n\t\tconst port = config.port === null ? 3000 : getPortValue(config.port);\n\t\tserver.listen(port);\n\t}\n\t```\n\t\u003c/details\u003e\n\n- [`Extract\u003cT, U\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union) - Extract from `T` those types that are assignable to `U`.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)\n\n\t```ts\n\tdeclare function uniqueId(): number;\n\n\tconst ID = Symbol('ID');\n\n\tinterface Person {\n\t\t[ID]: number;\n\t\tname: string;\n\t\tage: number;\n\t}\n\n\t// Allows changing the person data as long as the property key is of string type.\n\tfunction changePersonData\u003c\n\t\tObj extends Person,\n\t\tKey extends Extract\u003ckeyof Person, string\u003e,\n\t\tValue extends Obj[Key]\n\t\u003e (obj: Obj, key: Key, value: Value): void {\n\t\tobj[key] = value;\n\t}\n\n\t// Tiny Andrew was born.\n\tconst andrew = {\n\t\t[ID]: uniqueId(),\n\t\tname: 'Andrew',\n\t\tage: 0,\n\t};\n\n\t// Cool, we're fine with that.\n\tchangePersonData(andrew, 'name', 'Pony');\n\n\t// Government didn't like the fact that you wanted to change your identity.\n\tchangePersonData(andrew, ID, uniqueId());\n\t```\n\t\u003c/details\u003e\n\n- [`NonNullable\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype) - Exclude `null` and `undefined` from `T`.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\tWorks with \u003ca href=\"https://www.typescriptlang.org/tsconfig#strictNullChecks\"\u003e\u003ccode\u003estrictNullChecks\u003c/code\u003e\u003c/a\u003e set to \u003ccode\u003etrue\u003c/code\u003e.\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)\n\n\t```ts\n\ttype PortNumber = string | number | null;\n\n\t/** Part of a class definition that is used to build a server */\n\tclass ServerBuilder {\n\t\t\tportNumber!: NonNullable\u003cPortNumber\u003e;\n\n\t\t\tport(this: ServerBuilder, port: PortNumber): ServerBuilder {\n\t\t\t\t\tif (port == null) {\n\t\t\t\t\t\t\tthis.portNumber = 8000;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.portNumber = port;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\t\t\t}\n\t}\n\n\tconst serverBuilder = new ServerBuilder();\n\n\tserverBuilder\n\t\t\t.port('8000')   // portNumber = '8000'\n\t\t\t.port(null)     // portNumber =  8000\n\t\t\t.port(3000);    // portNumber =  3000\n\n\t// TypeScript error\n\tserverBuilder.portNumber = null;\n\t```\n\t\u003c/details\u003e\n\n- [`Parameters\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype) - Obtain the parameters of a function type in a tuple.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)\n\n\t```ts\n\tfunction shuffle(input: any[]): void {\n\t\t// Mutate array randomly changing its' elements indexes.\n\t}\n\n\tfunction callNTimes\u003cFn extends (...arguments_: any[]) =\u003e any\u003e (func: Fn, callCount: number) {\n\t\t// Type that represents the type of the received function parameters.\n\t\ttype FunctionParameters = Parameters\u003cFn\u003e;\n\n\t\treturn function (...arguments_: FunctionParameters) {\n\t\t\tfor (let i = 0; i \u003c callCount; i++) {\n\t\t\t\tfunc(...arguments_);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst shuffleTwice = callNTimes(shuffle, 2);\n\t```\n\t\u003c/details\u003e\n\n- [`ConstructorParameters\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#constructorparameterstype) - Obtain the parameters of a constructor function type in a tuple.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)\n\n\t```ts\n\tclass ArticleModel {\n\t\ttitle: string;\n\t\tcontent?: string;\n\n\t\tconstructor(title: string) {\n\t\t\tthis.title = title;\n\t\t}\n\t}\n\n\tclass InstanceCache\u003cT extends (new (...arguments_: any[]) =\u003e any)\u003e {\n\t\tprivate ClassConstructor: T;\n\t\tprivate cache: Map\u003cstring, InstanceType\u003cT\u003e\u003e = new Map();\n\n\t\tconstructor (ctr: T) {\n\t\t\tthis.ClassConstructor = ctr;\n\t\t}\n\n\t\tgetInstance (...arguments_: ConstructorParameters\u003cT\u003e): InstanceType\u003cT\u003e {\n\t\t\tconst hash = this.calculateArgumentsHash(...arguments_);\n\n\t\t\tconst existingInstance = this.cache.get(hash);\n\t\t\tif (existingInstance !== undefined) {\n\t\t\t\treturn existingInstance;\n\t\t\t}\n\n\t\t\treturn new this.ClassConstructor(...arguments_);\n\t\t}\n\n\t\tprivate calculateArgumentsHash(...arguments_: any[]): string {\n\t\t\t// Calculate hash.\n\t\t\treturn 'hash';\n\t\t}\n\t}\n\n\tconst articleCache = new InstanceCache(ArticleModel);\n\tconst amazonArticle = articleCache.getInstance('Amazon forests burning!');\n\t```\n\t\u003c/details\u003e\n\n- [`ReturnType\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#returntypetype) - Obtain the return type of a function type.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)\n\n\t```ts\n\t/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */\n\tfunction mapIter\u003c\n\t\t\tElem,\n\t\t\tFunc extends (elem: Elem) =\u003e any,\n\t\t\tRet extends ReturnType\u003cFunc\u003e\n\t\u003e(iter: Iterable\u003cElem\u003e, callback: Func): Ret[] {\n\t\t\tconst mapped: Ret[] = [];\n\n\t\t\tfor (const elem of iter) {\n\t\t\t\t\tmapped.push(callback(elem));\n\t\t\t}\n\n\t\t\treturn mapped;\n\t}\n\n\tconst setObject: Set\u003cstring\u003e = new Set();\n\tconst mapObject: Map\u003cnumber, string\u003e = new Map();\n\n\tmapIter(setObject, (value: string) =\u003e value.indexOf('Foo')); // number[]\n\n\tmapIter(mapObject, ([key, value]: [number, string]) =\u003e {\n\t\t\treturn key % 2 === 0 ? value : 'Odd';\n\t}); // string[]\n\t```\n\t\u003c/details\u003e\n\n- [`InstanceType\u003cT\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#instancetypetype) - Obtain the instance type of a constructor function type.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)\n\n\t```ts\n\tclass IdleService {\n\t\t\tdoNothing (): void {}\n\t}\n\n\tclass News {\n\t\t\ttitle: string;\n\t\t\tcontent: string;\n\n\t\t\tconstructor(title: string, content: string) {\n\t\t\t\t\tthis.title = title;\n\t\t\t\t\tthis.content = content;\n\t\t\t}\n\t}\n\n\tconst instanceCounter: Map\u003cFunction, number\u003e = new Map();\n\n\tinterface Constructor {\n\t\t\tnew(...arguments_: any[]): any;\n\t}\n\n\t// Keep track how many instances of `Constr` constructor have been created.\n\tfunction getInstance\u003c\n\t\t\tConstr extends Constructor,\n\t\t\tArguments extends ConstructorParameters\u003cConstr\u003e\n\t\u003e(constructor: Constr, ...arguments_: Arguments): InstanceType\u003cConstr\u003e {\n\t\t\tlet count = instanceCounter.get(constructor) || 0;\n\n\t\t\tconst instance = new constructor(...arguments_);\n\n\t\t\tinstanceCounter.set(constructor, count + 1);\n\n\t\t\tconsole.log(`Created ${count + 1} instances of ${Constr.name} class`);\n\n\t\t\treturn instance;\n\t}\n\n\n\tconst idleService = getInstance(IdleService);\n\t// Will log: `Created 1 instances of IdleService class`\n\tconst newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');\n\t// Will log: `Created 1 instances of News class`\n\t```\n\t\u003c/details\u003e\n\n- [`Omit\u003cT, K\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) - Constructs a type by picking all properties from T and then removing K.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\t\tExample\n\t\u003c/summary\u003e\n\n\t[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)\n\n\t```ts\n\tinterface Animal {\n\t\t\timageUrl: string;\n\t\t\tspecies: string;\n\t\t\timages: string[];\n\t\t\tparagraphs: string[];\n\t}\n\n\t// Creates new type with all properties of the `Animal` interface\n\t// except 'images' and 'paragraphs' properties. We can use this\n\t// type to render small hover tooltip for a wiki entry list.\n\ttype AnimalShortInfo = Omit\u003cAnimal, 'images' | 'paragraphs'\u003e;\n\n\tfunction renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {\n\t\t\tconst container = document.createElement('div');\n\t\t\t// Internal implementation.\n\t\t\treturn container;\n\t}\n\t```\n\t\u003c/details\u003e\n\n- [`Uppercase\u003cS extends string\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uppercasestringtype) - Transforms every character in a string into uppercase.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\tExample\n\t\u003c/summary\u003e\n\n\t```ts\n\ttype T = Uppercase\u003c'hello'\u003e;  // 'HELLO'\n\n\ttype T2 = Uppercase\u003c'foo' | 'bar'\u003e;  // 'FOO' | 'BAR'\n\n\ttype T3\u003cS extends string\u003e = Uppercase\u003c`aB${S}`\u003e;\n\ttype T4 = T3\u003c'xYz'\u003e;  // 'ABXYZ'\n\n\ttype T5 = Uppercase\u003cstring\u003e;  // string\n\ttype T6 = Uppercase\u003cany\u003e;  // any\n\ttype T7 = Uppercase\u003cnever\u003e;  // never\n\ttype T8 = Uppercase\u003c42\u003e;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t\u003c/details\u003e\n\n- [`Lowercase\u003cS extends string\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#lowercasestringtype) - Transforms every character in a string into lowercase.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\tExample\n\t\u003c/summary\u003e\n\n\t```ts\n\ttype T = Lowercase\u003c'HELLO'\u003e;  // 'hello'\n\n\ttype T2 = Lowercase\u003c'FOO' | 'BAR'\u003e;  // 'foo' | 'bar'\n\n\ttype T3\u003cS extends string\u003e = Lowercase\u003c`aB${S}`\u003e;\n\ttype T4 = T3\u003c'xYz'\u003e;  // 'abxyz'\n\n\ttype T5 = Lowercase\u003cstring\u003e;  // string\n\ttype T6 = Lowercase\u003cany\u003e;  // any\n\ttype T7 = Lowercase\u003cnever\u003e;  // never\n\ttype T8 = Lowercase\u003c42\u003e;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t\u003c/details\u003e\n\n- [`Capitalize\u003cS extends string\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#capitalizestringtype) - Transforms the first character in a string into uppercase.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\tExample\n\t\u003c/summary\u003e\n\n\t```ts\n\ttype T = Capitalize\u003c'hello'\u003e;  // 'Hello'\n\n\ttype T2 = Capitalize\u003c'foo' | 'bar'\u003e;  // 'Foo' | 'Bar'\n\n\ttype T3\u003cS extends string\u003e = Capitalize\u003c`aB${S}`\u003e;\n\ttype T4 = T3\u003c'xYz'\u003e;  // 'ABxYz'\n\n\ttype T5 = Capitalize\u003cstring\u003e;  // string\n\ttype T6 = Capitalize\u003cany\u003e;  // any\n\ttype T7 = Capitalize\u003cnever\u003e;  // never\n\ttype T8 = Capitalize\u003c42\u003e;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t\u003c/details\u003e\n\n- [`Uncapitalize\u003cS extends string\u003e`](https://www.typescriptlang.org/docs/handbook/utility-types.html#uncapitalizestringtype) - Transforms the first character in a string into lowercase.\n\t\u003cdetails\u003e\n\t\u003csummary\u003e\n\t\tExample\n\t\u003c/summary\u003e\n\n\t```ts\n\ttype T = Uncapitalize\u003c'Hello'\u003e;  // 'hello'\n\n\ttype T2 = Uncapitalize\u003c'Foo' | 'Bar'\u003e;  // 'foo' | 'bar'\n\n\ttype T3\u003cS extends string\u003e = Uncapitalize\u003c`AB${S}`\u003e;\n\ttype T4 = T3\u003c'xYz'\u003e;  // 'aBxYz'\n\n\ttype T5 = Uncapitalize\u003cstring\u003e;  // string\n\ttype T6 = Uncapitalize\u003cany\u003e;  // any\n\ttype T7 = Uncapitalize\u003cnever\u003e;  // never\n\ttype T8 = Uncapitalize\u003c42\u003e;  // Error, type 'number' does not satisfy the constraint 'string'\n\t```\n\t\u003c/details\u003e\n\nYou can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/utility-types.html).\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Haozheng Li](https://github.com/Emiyaaaaa)\n- [Som Shekhar Mukherjee](https://github.com/som-sm)\n- [Jarek Radosz](https://github.com/CvX)\n- [Dimitri Benin](https://github.com/BendingBender)\n- [Pelle Wessman](https://github.com/voxpelli)\n- [Sébastien Mischler](https://github.com/skarab42)\n\n## License\n\n- [MIT](license-mit)\n- [CC0-1.0](license-cc0)\n\nSPDX-License-Identifier: (MIT OR CC0-1.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ftype-fest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Ftype-fest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ftype-fest/lists"}