
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@skypilot/common-types
Advanced tools
A library of reusable common types for TypeScript projects
type AnyRecord = Record<string, any>
// Describes an object without properties
type EmptyObject = { [key: string]: never; [key: number]: never }
interface Class<T> extends Function {
new(...args: any[]): T
}
type Enum<E> = Record<keyof E, number | string> & { [key: number]: string }
type Primitive = boolean | number | string;
// Constructs a type that matches any serializable value
export type AsJsonValue<T> =
T extends JsonPrimitive ? T :
T extends Function ? never :
T extends Array<unknown> ? AsJsonArray<T> :
T extends object ? AsJsonMap<T> :
never;
// Constructs a type that matches any serializable array
export type AsJsonArray<T> = Array<AsJsonValue<UnpackedArray<T>>>
// Constructs a type that matches any serializable object map
export type AsJsonMap<T> =
T extends Array<unknown> ? never :
{[K in keyof T]: AsJsonValue<T[K]> };
interface DefiniteJsonArray extends Array<DefiniteJsonValue> {}
type DefiniteJsonMap = {
[key: string]: DefiniteJsonArray | DefiniteJsonMap | JsonPrimitive;
}
type DefiniteJsonValue = DefiniteJsonArray | DefiniteJsonMap | JsonPrimitive;
interface JsonArray extends Array<JsonValue> {}
type JsonMap = {
[key: string]: JsonArray | JsonMap | JsonPrimitive | undefined;
}
type JsonPrimitive = boolean | number | string | null;
type JsonValue = JsonArray | JsonMap | JsonPrimitive | undefined;
These types provide semantic value only. (Until TypeScript allows pattern-matching, the patterns these types imply will not be enforced.)
type Email = string
type Integer = number
type Json = string
type Timestamp = Integer
type Url = string
ArrayItems<A>
: constructs a type that is the union of all items in array A
AtLeastOne<T>
: constructs a type that requires at least one property of T
ExactlyOne<T>
: constructs a type that requires exactly one property of T
Maybe<T>
: constructs a type that allows T
, null
, or undefined
MaybeNull<T>
: constructs a type that allows T
or null
MaybeReadOnly<T>
: constructs a type that allows T[]
or readonly T[]
MaybeUndefined<T>
: constructs a type that allows T
or undefined
ObjectEntries<O>
: constructs a type that is the union of the types of all entries in object O
ObjectKeys<O>
: constructs a type that is the union of all keys in object O
ObjectValues<O, K?>
: constructs a type that is the union of all values in object O
, or, if K
is provided, of all values mapped to keys K
in object O
PromisedReturnType<F>
: obtains the promised return type of function F
Require<T, Required>
[DEPRECATED in favor of RequireProps
]: constructs a type that makes the
Required
properties of T
required
RequireProps<T, Required>
: constructs a type that makes the Required
properties of T
required
UnpackedArray<T>
: constructs a type that is the union of the types of the items in an array of type T
FAQs
Library of reusable common types for TypeScript projects
The npm package @skypilot/common-types receives a total of 306 weekly downloads. As such, @skypilot/common-types popularity was classified as not popular.
We found that @skypilot/common-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 Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.