sindresorhus / type-fest
A collection of essential TypeScript types
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing sindresorhus/type-fest in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewA collection of essential TypeScript types Sindre Sorhus' open source work is supported by the community Special thanks to: Effortless backends with infrastructure from code An open-source framework that supports any programming language, cloud provider, or deployment automation tool. Many of the types here should have been built-in. You can help by suggesting some of them to the TypeScript project. Either add this package as a dependency or copy-paste the needed types. No credit required. 👌 PR welcome for additional commonly needed types and docs improvements. Read the contributing guidelines first. **Help wanted with reviewing proposals and pull requests.** Install *Requires TypeScript >=5.9, ESM, and in your tsconfig.* > [!NOTE] > This readme shows the current development version. For docs about the latest version, see the npm page. *You may also like my package which provides runtime functions for some of these types.* Usage API Click the type names for complete docs. Basic • - Matches any primitive value. • - Matches a . • - Matches a constructor. • - Matches an . • - Matches an constructor. • - Matches any typed array, like or . • - Matches a value that is like an Observable. • - Matches any lowercase letter in the basic Latin alphabet (a-z). • - Matches any uppercase letter in the basic Latin alphabet (A-Z). • - Matches any digit as a string ('0'-'9'). • - Matches any lowercase letter (a-z), uppercase letter (A-Z), or digit ('0'-'9') in the basic Latin alphabet. Utilities • - Represents a strictly empty plain object, the value. • - Represents an object with at least 1 non-optional key. • - Represents an object with value. You probably want this instead of . • - Represents an array with value. • - Represents a map with key and value. • - Represents a set with value. • - Create a type from an object type without certain keys. This is a stricter version of . • - Create a type that strips from the given type. Inverse of . • - Create a deeply mutable version of an / / / type. The inverse of . Use if you only need one level deep. • - Merge two types into a new type. Keys of the second type overrides keys of the first type. • - Merge two object types into a new object type, where keys from the second override keys from the first. • - Merge two objects or two arrays/tuples recursively into a new type. • - Create a type that has mutually exclusive keys. • - Override only existing properties of the given type. Similar to , but enforces that the original type has the properties you want to override. • - Create a type that requires at least one of the given keys. • - Create a type that requires exactly a single key of the given keys and disallows more. • - Create a type that requires all of the given keys or none of the given keys. • - Create a type that requires exactly a single key of the given keys and disallows more, or none of the given keys. • - Create a type that only accepts an object with a single key. • - Create a deeply required version of another type. Use if you only need one level deep. • - Pick properties from a deeply-nested object. Use if you only need one level deep. • - Omit properties from a deeply-nested object. Use if you only need one level deep. • - Omit any index signatures from the given object type, leaving only explicitly defined properties. • - Pick only index signatures from the given object type, leaving out all explicitly defined properties. • - Create a deeply optional version of another type. Use if you only need one level deep. • - Create a deep version of another type where all keys accepting type are set to optional. • - Create a deep version of another type where all optional keys are set to also accept . • - Revert the modifier on an object type. • - Create a deeply immutable version of an / / / type. Use if you only need one level deep. • - 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. • - Create a tagged type that can support multiple tags and per-tag metadata. (This replaces the previous type, which is now deprecated.) • - Get the untagged portion of a tagged type created with . (This replaces the previous type, which is now deprecated.) • - Create an invariant type, which is a type that does not accept supertypes and subtypes. • - Create a type that makes the given keys optional. • - Create a type that makes the given keys readonly. • - Create a type that makes the given keys required. • - Like except it selects the keys deeply. • - Create a type that makes the given keys non-nullable. • - Create a type that makes the specified keys non-nullable (removes and ), supports deeply nested key paths, and leaves all other keys unchanged. • - Create a union of the given object's values, and optionally specify which keys to get the values from. • - Extract keys from a shape where values extend the given type. • - Like except it selects properties from a shape where the values extend the given type. • - Like except that it selects the properties deeply. • - Like except it removes properties from a shape where the values extend the given type. • - Convert a union type to an intersection type. • - Convert a literal type to the primitive type it belongs to. • - Like except it converts literal types inside an object or array deeply. • - Create a type with the keys of the given type changed to type. • - Get the element type of an / . For example, , , , generator, stream, etc. • - Create a type that represents the type of an entry of a collection. • - Create a type that represents the type of the entries of a collection. • - Create a function type with a return type of your choice and the same parameters as the given function type. • - Create a function that replaces some parameters with the given parameters. • - Useful to flatten the type output to improve type hints shown in editors. And also to t…