site icon indicating copy to clipboard operation
site copied to clipboard

Article: how to override third party types?

Open JoshuaKGoldberg opened this issue 3 years ago • 1 comments

A question brought up on my Twitch stream today: overriding types of third party libraries if the types aren't made to be extended?

Example: some-library exports an interface MyData, and in your code you need to have an extra property myProperty added to all instances of MyData?

A more specific example: https://github.com/versatica/mediasoup/blob/41e2f52786a61942209512ca5ce20798baad8b96/node/lib/Worker.d.ts#L39

Thanks voltaryx on Twitch for bringing up! 🙌

JoshuaKGoldberg avatar Aug 16 '22 19:08 JoshuaKGoldberg

See also: https://twitter.com/phunkren/status/1561794275855241216

JoshuaKGoldberg avatar Aug 22 '22 19:08 JoshuaKGoldberg