Type-Safe
Full TypeScript support with type inference and compile-time safety
Enhanced AbortController with Node.js-style patterns for modern TypeScript applications. Clean, fully type-safe with zero external libraries. Built on top of the native Web API AbortController.
npm install @nodelibraries/enhanced-abort-controllerimport { EnhancedAbortController } from '@nodelibraries/enhanced-abort-controller';
const controller = new EnhancedAbortController();
controller.abortAfter(5000); // Abort after 5 seconds
// Use with fetch
fetch('https://api.example.com/data', {
signal: controller.signal.signal,
}).catch((err) => {
if (err.name === 'AbortError') {
console.log('Request was cancelled');
}
});@nodelibraries/enhanced-abort-controller is an enhanced version of the native AbortController with additional features for modern Node.js and TypeScript applications. It provides timeout-based cancellation, linked controllers, and proper resource cleanup patterns.
Learn more about our features and design principles in the Introduction guide.
No decorators, no annotations, no framework lock-in. Your code remains pure and framework-agnostic.
// Clean, simple usage
const controller = new EnhancedAbortController();
controller.abortAfter(5000); // Auto-abort after 5 secondsBuilt from the ground up for TypeScript. Full type inference, autocomplete, and compile-time safety.
// Full type safety with autocomplete
const controller = new EnhancedAbortController();
controller.signal.throwIfAborted(); // โ
TypeScript knows this method existsBattle-tested features including timeout management, linked controllers, and comprehensive error handling.
// Linked controllers for complex scenarios
const userController = new EnhancedAbortController();
const timeoutController = EnhancedAbortController.timeout(10000);
// Abort if user cancels OR timeout occurs
const linked = EnhancedAbortController.linkSignals(
userController.signal,
timeoutController.signal
);Additional features beyond the native AbortController:
whenAborted promise for async workflowsUse with:
npm install @nodelibraries/enhanced-abort-controllerNo additional configuration required! The library has zero dependencies and works out of the box.