linqts is a TypeScript library that ports LINQ (Language Integrated Query) capabilities, familiar to C# developers, to JavaScript and TypeScript environments. It provides a `List<T>` class that offers a rich set of methods for querying and manipulating collections in a fluent, declarative style, including operations like `Where`, `Select`, `Join`, `GroupBy`, `Min`, and `Max`. The library is currently stable at version 3.2.0 and maintains an active development cadence with major releases approximately annually and more frequent minor and patch updates addressing features and bug fixes. Its primary differentiator is the direct porting of the LINQ API surface, which makes it intuitive for developers coming from a .NET background, providing strong type safety through TypeScript.
npm install linqtsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic filtering, mapping, and joining operations using the `List` class to perform LinQ-style queries on in-memory collections.
Review calls to `Min()` and `Max()` to ensure correct generic type arguments or selectors are provided, especially if working with complex objects. For example, `list.Min(x => x.property)`.
Carefully test existing code that uses `ToDictionary()` or any `*OrDefault()` methods. Update logic if their new behavior (especially regarding default values for `*OrDefault` and key collisions for `ToDictionary`) no longer aligns with assumptions. Ensure your `tsconfig.json` is configured correctly for strict mode if enabling it.
If your code previously relied on `ElementAtOrDefault()` throwing an error for out-of-range indices, you must update it to explicitly check for `undefined` return values.
Ensure you are using `linqts@1.14.4` or newer to avoid potential CommonJS module resolution issues in TypeScript projects.
Provide a selector function to `Min()` or `Max()` to specify the property to compare, e.g., `list.Min(item => item.value)`.
Ensure you use `import { List } from 'linqts';` for ESM/TypeScript or `const { List } = require('linqts');` for CommonJS.Consult the `linqts` documentation for `ToDictionary()` in version 2.0.0 and above. Ensure your key selector returns unique keys or handle potential collisions as per the new behavior.
No dependency data recorded yet.