It's been ages, but I swear that sometime in 2017 or so, @danr.bsky.social (TS team) told me "Use interfaces, not types, for objects". I've also seen people whom I trust less tell everyone to "use types, not interfaces".
What is everyone doing now? cc @mattpocock.com
What is everyone doing now? cc @mattpocock.com
Comments
But that's honestly just my rudimentary understanding of it.
https://www.totaltypescript.com/type-vs-interface-which-should-you-use
If you're choosing between those, interface extends is pretty much always better. type vs interface is basically moot.
Always prefer to use properties with function types, not methods
Methods are bivariant even with --strictFunctionTypes
https://www.typescriptlang.org/play/?target=9&jsx=4#code/PTAEGUEMFsFNQGYHsBOoBGSAuALUBLAOy1hQUgGNYBnUSQgE1CwE8AHeSAG30mpoBQREmUrwAogA8YbLvADeA0KDi4kDABRE2AVywAuUIR3R0pUAB8jOrlwCUhgG5J8DJaDYokbQ1sK6Da1NzK2NbO1AAXgA+UGdXAQBfAQEQUAA5bFhDABUcfFoCo2xQCiRoNkgsfHQ5UAB3fFxmHHgEHUIKaqRCZnYaOkxHWAF2zu7ewh70my5IWtg-AMNjYJQIxWU0gCUO6rhQUi80fAQG+ErqQt6AAzCuG-cywmokOQA6LiQAcyW9d6wSAACihYBQCvgeho7HYkik5FhDtIKnJDFIZHVIqBNqA0gAhbB4JBnXA0eDUHBIGxMMyHFDHajuVSUhgraazeZyAA0uLAAElOqhQV13J5vGzCDNbJzYDy0gBhIVgrBJIA
https://www.totaltypescript.com/type-vs-interface-which-should-you-use
https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections
Matt Pocock comes to the conclusion that type is simpler to reason about for the most part though:
https://www.totaltypescript.com/type-vs-interface-which-should-you-use#default-to-type-not-interface