Extending Array in Typescript

Bryce Shaw
Jul 29, 2021

--

Do you ever wish that arrays in javascript / typescript did more things? Monkey patching (adding or modifying methods on the built-in objects of a library or language at runtime) is widely regarded as a bad idea, but extending the Array class gets you to the same place with a lot less in the way of unforeseen consequences…

I thought this was a pretty neat trick.

--

--