Registry / serialization / typedash

typedash

JSON →
library3.3.3jsnpmunverified

Typedash is a modern, type-safe collection of utility functions designed for TypeScript environments, offering a robust alternative to libraries like Lodash with a strong focus on simplicity, tree-shaking, and precise type inference. It currently stands at version 3.3.3 and maintains a fairly active release cadence with frequent minor and patch updates, as evidenced by recent changelog entries. Key differentiators include its complete type-safety, ensuring type-level transformations for string casing functions and precise key/value types for object utilities. The library boasts zero runtime dependencies, making it highly tree-shakeable and performant. It operates on the principle of "trust the compiler" by leveraging TypeScript's robust type system for correctness rather than relying on extensive runtime checks. Typedash provides over 60 utility functions categorized for Array, Object, String, Type Guards, Function, and Math operations.

npm install typedash
INSTALL
IMPORT
SIG · TYPEDASH
T
typedash
serializationjavascriptv3.3.3
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

pick
import { pick } from 'typedash'
const { pick } = require('typedash')
Typedash is primarily designed for ESM consumption, especially with its tree-shaking capabilities. While CommonJS 'require' might work in some setups, direct named imports are the intended and most reliable approach.
camelCase
import { camelCase } from 'typedash'
The `camelCase` function returns a type-level transformed string literal type (e.g., 'fooBarBaz'), not just `string`, for enhanced type safety and auto-completion.
objectKeys
import { objectKeys } from 'typedash/objectKeys'
import objectKeys from 'typedash/objectKeys'
Individual function imports, such as this explicit path, are recommended for optimal tree-shaking, allowing bundlers to include only the code you use.

This quickstart demonstrates `typedash`'s core features including `pick` for object property selection, `objectKeys` for precise key inference, `camelCase` for type-level string transformations, and `compact` for array filtering, all with robust TypeScript support.

import { pick, objectKeys, camelCase, compact } from 'typedash'; interface User { id: string; firstName: string; lastName: string; email: string; isAdmin?: boolean; 'user-role': string; } const userData: User = { id: '123', firstName: 'John', lastName: 'Doe', email: 'john.doe@example.com', isAdmin: false, 'user-role': 'admin' }; // Demonstrate pick for selecting properties with preserved types const publicInfo = pick(userData, ['id', 'firstName', 'lastName']); console.log('Public Info:', publicInfo); // Expected type: { id: string; firstName: string; lastName: string; } // Demonstrate objectKeys with precise type inference for array of keys const keys = objectKeys(publicInfo); console.log('Keys:', keys); // Expected type: ("id" | "firstName" | "lastName")[] // Demonstrate camelCase for string literal transformation const userRoleKey = camelCase(userData['user-role']); console.log('CamelCased Role Key:', userRoleKey); // Expected type: "userRole" // Demonstrate compact for array filtering, inferring non-falsy types const values = [0, 1, false, '', 'hello', null, undefined]; const compacted = compact(values); console.log('Compacted Array:', compacted); // Expected type: (1 | "hello")[]
Debug
Known issues
gotchaTypedash relies heavily on TypeScript's type system for correctness and performs minimal runtime validation. Unlike libraries such as Lodash, it generally does not include extensive runtime checks for input types or values, operating on the principle of 'trust the compiler'.
fix
Ensure your codebase is strictly typed and compiler errors are addressed. Runtime type checking should be implemented separately if required for untrusted input at boundaries.
affects: >=3.0.0
breakingTypedash requires Node.js version 20.0.0 or higher. Older Node.js versions are not supported and may lead to runtime errors or unexpected behavior due to modern language features and module resolution.
fix
Upgrade your Node.js environment to version 20.0.0 or newer using `nvm` or your preferred Node.js version manager.
affects: >=3.0.0
breakingVersions of Typedash prior to 3.2.3 may have experienced issues with CommonJS consumers, specifically regarding module resolution and incorrect builds, which could lead to `TypeError: ... is not a function` errors when using `require()`.
fix
Upgrade to Typedash version 3.2.3 or newer to resolve CommonJS build and import issues. For older Node.js projects, consider using individual function imports (e.g., `require('typedash/pick')`) if the main entry point causes problems.
affects: <3.2.3
Errors
Common errors & fixes
TypeError: (0, typedash_1.pick) is not a function
This error typically indicates incorrect CommonJS `require` syntax, bundler misconfiguration, or an attempt to import a module primarily designed for ESM using CJS patterns.
fix
Ensure you are using `import { functionName } from 'typedash'` for named ESM imports in a compatible environment. If using CommonJS, individual function imports like `const pick = require('typedash/pick')` are often more reliable, as full CJS support for the main entry point may vary by version and build setup.
Property 'xyz' does not exist on type 'ABC'.
Attempting to access a property that TypeScript's inferred type for the object does not include, often due to an incorrect type assertion or unexpected input. Typedash's strict typing will surface these issues.
fix
Review your object's type definition and ensure it accurately reflects all possible properties. Use type assertions (`as Type`) sparingly and only when you are absolutely certain of the type. For dynamic property access, consider using type guards or utility functions like `objectKeys` to safely narrow types.
Argument of type 'string[]' is not assignable to parameter of type 'keyof T | readonly (keyof T)[]'.
Providing an array of generic `string` literals where Typedash expects an array of specific literal keys derived from the object's type, typically when using functions like `pick` or `omit`.
fix
Ensure the array of keys passed to functions like `pick` or `omit` is correctly typed as a `const` assertion (`['a', 'b'] as const`) or explicitly as a union of literal types (e.g., `const keys: Array<'a' | 'b'> = ['a', 'b'];`) so TypeScript can infer the precise subset of keys.
Upgrade
Version history
3.3.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
typedash — npm install typedash · libregistry