
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@kakasoo/deep-strict-types
Advanced tools
npm i @kakasoo/deep-strict-types
DeepStrictTypes extends TypeScript utility types, enabling safe operations like Omit
and Pick
on nested objects or arrays by specifying the keys to be inferred. This allows for more strict and accurate type checks.
DeepStrictObjectKeys<T>
extracts all nested keys from an object T
, preserving the structure of the nested object and returning the types of the keys. This is useful when you need to handle specific keys safely at deeper levels of an object.
type Example = {
user: {
name: string;
address: {
city: string;
zip: number;
};
};
};
// Result: "user" | "user.name" | "user.address" | "user.address.city" | "user.address.zip"
type Keys = DeepStrictObjectKeys<Example>;
DeepStrictOmit<T, K> creates a new type by excluding properties corresponding to the key K from object T, while preserving the nested structure. This type allows precise omission of keys even in deeply nested objects.
type Example = {
user: {
name: string;
age: number;
};
};
// Result: { user: { age: number; } }
type Omitted = DeepStrictOmit<Example, "user.name">;
DeepStrictPick<T, K> creates a new type by selecting only the properties corresponding to the key K from object T, while preserving the nested structure. It allows safely selecting specific keys even from deep objects.
type Example = {
user: {
name: string;
age: number;
};
};
// Result: { user: { name: string; } }
type Picked = DeepStrictPick<Example, "user.name">;
DeepStrictUnbrand removes branding from type T and applies it even to deeply nested objects. This makes handling complex branded types simpler by removing the branding for more straightforward use.
type BrandedType = { brand: number & { type: "won" } };
// Result: { value: number; }
type Unbranded = DeepStrictUnbrand<BrandedType>;
ElementOf extracts the type of elements from an array type T. This is useful to explicitly define the element type of an array and perform operations on that element.
type ArrayExample = string[];
// Result: string
type ElementType = ElementOf<ArrayExample>;
Equal<A, B> evaluates whether types A and B are the same and returns true or false. This is used to validate whether two types are identical.
type A = { a: number };
type B = { a: number };
// Result: true
type AreEqual = Equal<A, B>;
FAQs
typescript utility types including deep-strict-omit and pick type
The npm package @kakasoo/deep-strict-types receives a total of 254 weekly downloads. As such, @kakasoo/deep-strict-types popularity was classified as not popular.
We found that @kakasoo/deep-strict-types demonstrated a healthy version release cadence and project activity because the last version was released less than 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.