I have had cases in which a web search and some good old fashioned thinking have yielded better results than using an LLM, but on average Iām pretty sure the LLM has the edge.
The answers are in (i) the Typescript documentation and (ii) the documentation of libraries that I'm using. I could get lucky with a Google search and it could be worth trying, but I wouldn't expect it to work. Personally my preference is to have a language and libraries with great documentation (Python, Java, Typescript isn't too bad [1]) and really know that documentation like the back of my hand.
If I hadn't had the LLM I would have probably figured it out the same way doing experiments, I might have asked my other "rubber duck"
https://mastodon.social/@UP8/113935901671533690
A tactic I didn't use, which helps in "legacy" systems where I am stuck, is start a fresh project in the IDE and try either reproducing the problem or building a tiny system which is problem free.
I'm hesitant to say what speedup I got out of the "figuring out the types together with the LLM" but emotionally I felt supported and in the process I wrote a whole lot, like I was keeping track of the process in a notebook. I feel a lot times when I have good LLM conversations I wind up writing better code than I would otherwise, not necessarily write it faster -- it's like pair programming.
[1] The typescript docs are great for the typescript stuff, MDN is good for Javascript and Javascript's stdlib
I have to wonder if you tried a simple google search and read through some docs if you couldn't have figured this out quicker than trying to coax a result out of the LLM.