
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@meta-utils/types
Advanced tools
A package containing useful TypeScript types
KnownKeys<T>Similar to keyof T but excludes index signatures. This is useful because if T had a index signature
for string keys, you'd only get string from keyof T and there aren't many interesting things you
can do with that.
RequiredKnownKeys<T>All keys that correspond to required properties of T, excluding index signatures.
OptionalKnownKeys<T>All keys that correspond to optional properties of T, excluding index signatures.
UndefinedKnownKeys<T>All keys that correspond to properties of T which can be undefined, excluding index signatures.
IndexSignatureKeys<T>string if T has index signature which takes string,number if T has index singature which takes number,never otherwiseThese mapped types are similar in function to Required<T> and Partial<T>, the two types
that are already present in TypeScript. In fact, Required and Partial modify two orthogonal
qualities of the object at the same time, those are optionality/requiredness and definedness.
The types included in this library try to explore the whole extent of this space.

Explicit<T>Make all properties in T required, but keep undefined in their type.
The difference between Required and Explicit is that Required not only makes optional properties
required, it also removes undefined from their type. Explicit doesn't do that if you could assign a
value to a property of T, you can assign it to Explicit<T>. You just have to be explicit and list
all properties when defining a Explicit<T> object, even if they're undefined.
Implicit<T>The opposite of Explicit in the sense that it marks as optional
those properties which can be assigned undefined.
Defined<T>Removes undefined from the type of all properties. Required properties, that is.
Undefined<T>Makes all properties possibly undefined, but keep their requiredness.
The difference between Undefined and Partial is that Partial also marks all properties as optional.
RequiredDefined<T>Makes all properties in T required and removes undefined from their types. A shorthand for Defined<Required<T>>.
ArrayType<T>From a type union it extracts those types that are assignable to any[].
UnionToIntersection<T>Turns type union into type intersection. This is useful, for example, when you need to create
a mapped overloaded function: imagine you have an interface T and you want to generate
an overloaded method which takes the property key as an argument and returns the corresponding
property value. (This particular example isn't very useful but it demonstrates the potential
of this type for overloaded methods). It's quite easy to create a mapped type which has got the
to-be overloads:
type ObjectOfOverloads<T> =
{
[K in keyof T]: (key: K) => T[K]
};
Now you can turn the object of overloads to an union of overloads with an index type:
type UnionOfOverloads<T> = ObjectOfOverloads<T>[keyof T];
The only thing we're left to do is to convert the union into an intersection and we've got overloaded method we wanted:
type AccessorMethodTo<T> = UnionToIntersection<UnionOfOverloads<T>>;
Or in the full form:
type AccessorMethodTo<T> =
UnionToIntersection<
{
[K in keyof T]: (key: K) => T[K]
}[keyof T]
>;

FAQs
A package containing useful TypeScript types
We found that @meta-utils/types demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.