How can I use the TypeScript Compiler API to extract the type of an array? For example given this source:
let a: string[] = []
How can I go from getting the type string[]
to just string
?
ts-morph makes this easy but I haven't figured out how to replicate it with the raw TS Compiler API.
It seems that I need to use checker.getTypeArguments()
but it wants a ts.TypeReference
type which I don't know how to create.