Pinsave/counterstrike
1
1// Backwards-compatible iterator interfaces, augmented with iterator helper methods by lib.esnext.iterator in TypeScript 5.6.2// The IterableIterator interface does not contain these methods, which creates assignability issues in places where IteratorObjects3// are expected (eg. DOM-compatible APIs) if lib.esnext.iterator is loaded.4// Also ensures that iterators returned by the Node API, which inherit from Iterator.prototype, correctly expose the iterator helper methods5// if lib.esnext.iterator is loaded.6// TODO: remove once this package no longer supports TS 5.5, and replace NodeJS.BuiltinIteratorReturn with BuiltinIteratorReturn.7 8// Placeholders for TS <5.69interface IteratorObject<T, TReturn, TNext> {}10interface AsyncIteratorObject<T, TReturn, TNext> {}11 12declare namespace NodeJS {13 // Populate iterator methods for TS <5.614 interface Iterator<T, TReturn, TNext> extends globalThis.Iterator<T, TReturn, TNext> {}15 interface AsyncIterator<T, TReturn, TNext> extends globalThis.AsyncIterator<T, TReturn, TNext> {}16 17 // Polyfill for TS 5.6's instrinsic BuiltinIteratorReturn type, required for DOM-compatible iterators18 type BuiltinIteratorReturn = ReturnType<any[][typeof Symbol.iterator]> extends19 globalThis.Iterator<any, infer TReturn> ? TReturn20 : any;21}22 