collectionstypescript

Is there a typescript List<> and/or Map<> class/library?


Did they add a runtime List<> and/or Map<> type class to typepad 1.0? And if not, is there a solid library out there someone wrote that provides this functionality?

And in the case of List<>, is there a linked list where the elements in the list have the next/prev property? We need a list where from an element object (ie not from an iterator), we can get the next and previous elements in the list (or null if it's the first/last one).


Solution

  • Did they add a runtime List<> and/or Map<> type class to typepad 1.0

    No, providing a runtime is not the focus of the TypeScript team.

    is there a solid library out there someone wrote that provides this functionality?

    I wrote (really just ported over buckets to typescript): https://github.com/basarat/typescript-collections

    Update

    JavaScript / TypeScript now support this natively and you can enable them with lib.d.ts : https://basarat.gitbook.io/typescript/type-system/lib.d.ts along with a polyfill if you want 🌹