{"id":14985,"library":"ts-curry","title":"ts-curry Currying Utility","description":"ts-curry is a specialized utility library designed for currying functions in TypeScript, providing type-safe currying transformations for functions with up to four arguments. The package's current stable version is 1.0.4, released in July 2018. It has seen no further updates or releases since then, indicating that the project is abandoned. While it offers type safety for currying, its limitation to functions of arity 4 or less, and the lack of maintenance for several years, means it may not be compatible with modern TypeScript versions (e.g., TS 4.x, 5.x) or offer the flexibility of more actively maintained functional programming libraries. Its primary differentiator was its strong TypeScript typing at the time of its release.","status":"abandoned","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/tusharmath/ts-curry","tags":["javascript"],"install":[{"cmd":"npm install ts-curry","lang":"bash","label":"npm"},{"cmd":"yarn add ts-curry","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-curry","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package was primarily designed for TypeScript and ES Modules. Direct CommonJS `require` might lead to issues if the build system isn't configured correctly for transpilation, or if consuming an older CommonJS build.","wrong":"const { curry2 } = require('ts-curry');","symbol":"curry2","correct":"import { curry2 } from 'ts-curry';"},{"note":"Similarly available for functions taking 3 arguments.","symbol":"curry3","correct":"import { curry3 } from 'ts-curry';"},{"note":"The highest arity supported by the library's built-in utilities.","symbol":"curry4","correct":"import { curry4 } from 'ts-curry';"}],"quickstart":{"code":"import { curry2 } from 'ts-curry';\n\ninterface MyDate extends Date {\n  getDay(): number;\n}\n\n// Define a function with explicit types\nconst func = (a: number, b: MyDate): number => a + b.getDay();\n\n// Curry the function using curry2\nconst curried = curry2(func);\n\n// Call the curried function with all arguments at once\nconst date1: MyDate = new Date('2026-04-19T10:00:00Z') as MyDate; // Example date for consistent output\nconsole.log('Result (all args):', curried(2, date1));\n\n// Call the curried function step-by-step\nconst partialCurried = curried(2);\nconst date2: MyDate = new Date('2026-04-20T10:00:00Z') as MyDate; // Another example date\nconsole.log('Result (curried):', partialCurried(date2));\n\n// Type checking ensures correctness (this would error if types mismatch)\n// const wrongType = curried('hello', new Date()); // Would cause TypeScript error","lang":"typescript","description":"Demonstrates importing `curry2` and applying it to a TypeScript function, showing both single-call and step-by-step curried invocation, along with basic type safety."},"warnings":[{"fix":"Consider migrating to actively maintained functional programming libraries like Lodash/fp, Ramda, or a more modern TypeScript-focused utility that offers up-to-date type definitions and broader currying support.","message":"The `ts-curry` package is abandoned and has not been updated since July 2018. It is highly likely to have compatibility issues with modern TypeScript versions (e.g., 4.x, 5.x) due to significant language changes and stricter type inference over the years, potentially leading to incorrect or broken type definitions.","severity":"breaking","affected_versions":">=1.0.4"},{"fix":"For functions with higher arity, the library recommends refactoring them into smaller functions of lower arity. Alternatively, use a different currying library that supports arbitrary arity or provides a more generic `curry` function.","message":"The library explicitly supports currying only up to functions with an arity of 4 (via `curry2`, `curry3`, `curry4`). Attempting to curry functions with more than 4 arguments using these utilities will result in compile-time type errors or runtime unexpected behavior, as there are no higher-arity `curry` functions provided.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your `tsconfig.json` and build tool configurations (e.g., Webpack, Rollup, Vite) are set up to correctly handle older CommonJS modules. If issues persist, consider using a more contemporary library that offers native ESM support.","message":"Due to its age, `ts-curry` likely targets older versions of JavaScript and module systems. While it uses `import` syntax, its underlying CommonJS output or type definitions might cause issues when consumed in modern ESM-only Node.js environments or complex bundler setups, leading to module resolution errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using `import { curry2 } from 'ts-curry';` in a TypeScript/ESM context. If you must use CommonJS `require`, ensure your bundler or TypeScript configuration (e.g., `\"module\": \"commonjs\", \"esModuleInterop\": true`) is correctly set up to handle interop with older libraries.","cause":"This error often occurs in modern JavaScript environments (especially Node.js ESM) when trying to `require` or incorrectly import a package that expects `import` syntax or has an incompatible module export structure due to its age.","error":"TypeError: (0 , ts_curry_1.curry2) is not a function"},{"fix":"The `ts-curry` library is limited to currying functions of up to 4 arguments. Refactor your function to have 4 or fewer arguments, or choose a different currying library that supports higher arity functions.","cause":"Attempting to use `curry4` (or `curry2`, `curry3`) with a function that has more arguments than the `curryX` utility is designed to handle.","error":"Argument of type '(a: number, b: Date, c: string, d: boolean, e: any) => any' is not assignable to parameter of type '(a: any, b: any, c: any, d: any) => any'."},{"fix":"Ensure that the arguments passed to the curried function strictly conform to the expected TypeScript interface defined within `ts-curry`'s types. You might need to cast values or create specific instances that satisfy the type requirements, as shown in the quickstart example (e.g., `new Date() as MyDate`).","cause":"This is a typical TypeScript error indicating a mismatch between the expected type for a curried function's argument and the actual type provided, often due to specific interfaces being defined in the library's types that are not met by standard built-in types.","error":"Type 'Date' is not assignable to type 'MyDate'. Property 'getDay' is missing in type 'Date' but required in type 'MyDate'."}],"ecosystem":"npm"}