summaryrefslogtreecommitdiff
path: root/frontend-old/node_modules/@types/node/compatibility
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-11-09 11:15:19 +0800
committeraltaf-creator <dev@altafcreator.com>2025-11-09 11:15:19 +0800
commit8eff962cab608341a6f2fedc640a0e32d96f26e2 (patch)
tree05534d1a720ddc3691d346c69b4972555820a061 /frontend-old/node_modules/@types/node/compatibility
pain
Diffstat (limited to 'frontend-old/node_modules/@types/node/compatibility')
-rw-r--r--frontend-old/node_modules/@types/node/compatibility/iterators.d.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@types/node/compatibility/iterators.d.ts b/frontend-old/node_modules/@types/node/compatibility/iterators.d.ts
new file mode 100644
index 0000000..156e785
--- /dev/null
+++ b/frontend-old/node_modules/@types/node/compatibility/iterators.d.ts
@@ -0,0 +1,21 @@
+// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.
+// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects
+// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.
+// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods
+// if lib.esnext.iterator is loaded.
+// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn.
+
+// Placeholders for TS <5.6
+interface IteratorObject<T, TReturn, TNext> {}
+interface AsyncIteratorObject<T, TReturn, TNext> {}
+
+declare namespace NodeJS {
+ // Populate iterator methods for TS <5.6
+ interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}
+ interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}
+
+ // Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators
+ type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends
+ globalThis.Iterator<any, infer TReturn> ? TReturn
+ : any;
+}