I want to extend somebody else's types. In figuring out how to do so, I generally use "Go to Type Definition" to go and get a better idea of how the types are written so that I can figure out how to extend the types in question.
Then, without fail, I end up googling "typescript extend third-party types" and get answers from 2015-2018, ranging from "Based on how the definition is currently written you can't extend it externally" to "do this":
I find these really confusing to write (namespace vs. module vs. interface; should it be declare global?) and it requires a lot of guess and check.
It would be nice if I could right-click on an import or be able to have a "Quick fix" for Property 'foo' does not exist on type 'bar'. that would insert the appropriate code to extend that particular type.
(I don't actually think a "Quick fix" would be a good idea since that is in most cases not what you want to be doing, but hopefully you get my point).
I want to extend somebody else's types. In figuring out how to do so, I generally use "Go to Type Definition" to go and get a better idea of how the types are written so that I can figure out how to extend the types in question.
Then, without fail, I end up googling "typescript extend third-party types" and get answers from 2015-2018, ranging from "Based on how the definition is currently written you can't extend it externally" to "do this":
I find these really confusing to write (
namespace
vs.module
vs.interface
; should it bedeclare global
?) and it requires a lot of guess and check.It would be nice if I could right-click on an import or be able to have a "Quick fix" for
Property 'foo' does not exist on type 'bar'.
that would insert the appropriate code to extend that particular type.(I don't actually think a "Quick fix" would be a good idea since that is in most cases not what you want to be doing, but hopefully you get my point).
Alternatively, maybe this is an opportunity for improvement on https://www.typescriptlang.org/docs/handbook/declaration-merging.html.