
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
@ergodark/types
Advanced tools
This package contains various utility and helper types that can be imported by a TypeScript project.
This package only contains TypeScript types.
npm install @ergodark/types
You can use this library's types in your TypeScript projects like so:
import type { TypeNameHere } from '@ergodark/types'
const variable: TypeNameHere;
import type * as ErgoDark from '@ergodark/types'
const variable: ErgoDark.TypeNameHere;
This library provides the following types:
Represents all "primitive" types. Specifically: string, number, bigint,
boolean, symbol, null, and undefined.
import type { Primitive } from '@ergodark/types'
let primitive: Primitive = "yes";
primitive = 1;
primitive = Symbol('yes');
primitive = null;
primitive = new Date(); // <== TypeScript error
Represents all "falsy" types. Specifically: false, '', 0, null, and
undefined.
import type { Falsy } from '@ergodark/types'
let falsy: Falsy = "";
falsy = 0;
falsy = false;
falsy = null;
falsy = true; // <== TypeScript error
Represents all "nullish" types. Specifically: null and undefined.
import type { Nullish } from '@ergodark/types'
let nullish: Nullish = null;
nullish = undefined;
nullish = true; // <== TypeScript error
TypeScript's Partial utility type but applied recursively to every property and any sub-properties.
import type { DeepPartial } from '@ergodark/types'
type T = { a: string, b: { c: { d: number }}};
let t:T = { a: "enough!", b: { c: { d: 1 }}};
let t_bad:T = { a: "enough?" }; // <== TypeScript error
let t2:Partial<T> = { a: "enough?" };
let t2_bad:Partial<T> = { a: "enough?", b: {}}; // <== TypeScript error
let t3:DeepPartial<T> = { a: "enough?" };
let t3_ok:DeepPartial<T> = { a: "enough?", b: {}};
Represents any possible object key.
import type { AnyKey } from '@ergodark/types'
let key: AnyKey = "key";
key = Symbol('key');
key = true; // <== TypeScript error
Represents any possible function.
import type { AnyFunction } from '@ergodark/types'
let fn: AnyFunction = () => true;
fn = Symbol('key'); // <== TypeScript error
Represents any possible constructor.
import type { AnyConstructor } from '@ergodark/types'
let myConstructor: AnyConstructor = Date;
myConstructor = Symbol('key'); // <== TypeScript error
Represents any possible class.
import type { AnyClass } from '@ergodark/types'
let MyClass: AnyClass = class { bark() { return 'woof!' }};
MyClass = Symbol('key'); // <== TypeScript error
Represents any object with string keys. Alias of Record<string, unknown>.
import type { AnyRecord } from '@ergodark/types'
let record: AnyRecord = { a: 1 };
record = Symbol('key'); // <== TypeScript error
Recursively unwrap the return value of a resolved promise.
import type { Awaited } from '@ergodark/types'
const p1 = new Promise<boolean>(resolve => resolve(true));
const p2 = new Promise<typeof p1>(resolve => resolve(p1));
// Type of `p2` is Promise<Promise<boolean>> ...
let result: Awaited<typeof p2>; // <== However, type of `result` is boolean
Represents any valid (and a few invalid) HTTP status code.
import fetch from 'isomorphic-unfetch'
import type { HttpStatusCode } from '@ergodark/types'
const res = await fetch('https://google.com');
const status: HttpStatusCode = res.status;
Issues and pull requests are welcome! In lieu of a formal styleguide, take care to maintain the existing coding style.
Please test your code!
FAQs
Various utility and helper types for TypeScript projects
The npm package @ergodark/types receives a total of 20 weekly downloads. As such, @ergodark/types popularity was classified as not popular.
We found that @ergodark/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
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.