Registry / type-stubs / typescript-union

typescript-union

JSON →
library0.2.0jsnpmunverified

A utility library providing generic types for manipulating TypeScript unions at the type level. Version 0.2.0 is current; the package is experimental and sees infrequent updates. Key differentiators: offers type transformations such as filtering and mapping union members without runtime code. Alternatives like type-fest or utility-types provide broader type utilities but may lack union-specific operations.

npm install typescript-union
INSTALL
IMPORT
SIG · TYPESCRIPT-UNION
T
typescript-union
type-stubsjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

Filter
import { Filter } from 'typescript-union'
Used in type context only; no runtime export.
Split
import { Split } from 'typescript-union'
const { Split } = require('typescript-union')
ESM-only; avoid CommonJS require.
UnionToIntersection
import { UnionToIntersection } from 'typescript-union'
Exported as named type.

Demonstrates Filter and UnionToIntersection type utilities for union transformations.

import { Filter, UnionToIntersection } from 'typescript-union'; type Mixed = string | number | boolean; type OnlyStrings = Filter<Mixed, string>; // string type Funcs = ((x: string) => void) | ((x: number) => void); type Intersected = UnionToIntersection<Funcs>; // (x: string & number) => void
Debug
Known issues
deprecatedPackage is abandoned; no updates since 2020.
fix
Consider alternatives like type-fest or ts-essentials.
affects: >=0.0.0
gotchaAll exports are types only; importing at runtime will cause errors.
fix
Use import type syntax: import type { Filter } from 'typescript-union'.
affects: >=0.0.0
breakingRemoval of deprecated type aliases in version 0.2.0.
fix
Replace deprecated aliases with the new names per changelog.
affects: >=0.2.0
Errors
Common errors & fixes
Cannot find module 'typescript-union' or its corresponding type declarations.
Package not installed or missing type definitions.
fix
Install: npm install typescript-union --save-dev
'Filter' cannot be used as a value because it is a type.
Runtime usage of a type-only export.
fix
Remove from runtime code or use import type.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
typescript-union — npm install typescript-union · libregistry