Registry / testing / typelab

typelab

JSON →
library1.0.1jsnpmunverified

typelab v1.0.1 is a zero-dependency TypeScript library providing a suite of reusable, type-level utility types for everyday TypeScript development. Released under MIT license with active maintenance, it offers aliases (Primitive, Nullable), assertions (IsExtends, IsEqual, IsAny), conditional types (IfExtends, IfEqual, IfAny), and utility types (FunctionCallbackify, FunctionPromisify, ObjectAssign). Unlike similar libraries like type-fest or utility-types, typelab focuses purely on type-level operations with no runtime code, making it lightweight for dev dependencies. The package is ESM and CommonJS compatible, ships with TypeScript definitions, and has a simple, documented API.

npm install typelab
INSTALL
IMPORT
SIG · TYPELAB
T
typelab
testingjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Primitive
✓ import { Primitive } from 'typelab'
✗ import Primitive from 'typelab'
Named export only; default import is not supported.
IsExtends
✓ import { IsExtends } from 'typelab'
✗ const { IsExtends } = require('typelab')
CommonJS require is supported but not recommended; prefer ESM imports. The package exports only named members.
ObjectAssign
✓ import { ObjectAssign } from 'typelab'
✗ import { ObjectAssign } from 'typelab/types'
All types are exported from the main entry point; no subpath exports.
IfAny
✓ import { IfAny } from 'typelab'
✗ import { IfAny } from 'typelab/conditions'
No subpath exports; all types are in the root module.
FunctionCallbackify
✓ import { FunctionCallbackify } from 'typelab'
✗ import { FunctionCallbackify } from 'typelab/utils'
All types are exported from the main package index.

Demonstrates importing and using several typelab utility types for type-level checks and object merging.

import { IsExtends, IfExtends, Nullable, Primitive, ObjectAssign } from 'typelab'; // Type-level checks type Check1 = IsExtends<string, any>; // true type Check2 = IsExtends<number, string>; // false // Conditional types type Result = IfExtends<string, any, 'yes', 'no'>; // 'yes' // Nullable alias type MaybeString = Nullable<string>; // string | null // Primitive alias type P = Primitive; // string | number | boolean | symbol | bigint | null | undefined // Object merge type Merged = ObjectAssign<{ a: number }, { b: string }>; // { a: number; b: string }
Debug
Known issues
gotchaNullable excludes undefined; use Nullable<T> | undefined for both null and undefined.
fix
Explicitly union with undefined: Nullable<T> | undefined
affects: >=1.0.0
gotchaIsExtends and IfExtends treat union types specially: for unions, the condition is distributed over each member.
fix
For non-distributive behavior, use IsEqual or IfEqual with exact types.
affects: >=1.0.0
breakingNo breaking changes documented yet; API stable.
fix
Check release notes before upgrading.
affects: >=1.0.0
deprecatedNo deprecated APIs in current version.
fix
N/A
affects: >=1.0.0
Errors
Common errors & fixes
TS2322: Type 'string' is not assignable to type 'Primitive'.
Using Primitive as a type guard without ensuring all primitive types are covered.
fix
Primitive includes string, number, etc. Ensure value is a primitive: const x: Primitive = 'hello';
Type 'null' is not assignable to type 'Nullable<string>'.
Nullable includes only null, not undefined. If the value can be undefined, use Nullable<T> | undefined.
fix
Use Nullable<T> | undefined or cast: const x: Nullable<string> | undefined = null;
TS2344: Type 'T' does not satisfy the constraint '(...args: any[]) => any'.
Using FunctionCallbackify or FunctionPromisify on a non-function type.
fix
Ensure the type is a function signature: type Fn = (a: number) => string; type Cb = FunctionCallbackify<Fn>;
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
typelab — npm install typelab · libregistry