Please consider adding an API to get type of symbol that takes into account the exactOptionalPropertyTypes option.
Symbols of properties of object types like { a?: string } can be passed to getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration) and it returns a Type object of a string type. But that will not work with mapped types like Partial<{ a: string }>, because these do not have symbol.valueDeclaration.
I can only use .getTypeOfSymbol() with mapped types, but it does not take into account the exactOptionalPropertyTypes option.
The internal .getNonMissingTypeOfSymbol() does what I want to achieve by passing the result of .getTypeOfSymbol() through the internal .removeMissingType(). (The missingType is also internal.)
It might be too much to have both .getTypeOfSymbol() and .getNonMissingTypeOfSymbol() in the public API. Perhaps .getTypeOfSymbol() could be used to call both via some option or flag (similar to .typeToString())?
Or perhaps there is a solution that I could not figure out?
Please consider adding an API to get type of symbol that takes into account the
exactOptionalPropertyTypesoption.Symbols of properties of object types like
{ a?: string }can be passed togetTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration)and it returns aTypeobject of astringtype. But that will not work with mapped types likePartial<{ a: string }>, because these do not havesymbol.valueDeclaration.I can only use
.getTypeOfSymbol()with mapped types, but it does not take into account theexactOptionalPropertyTypesoption.The internal
.getNonMissingTypeOfSymbol()does what I want to achieve by passing the result of.getTypeOfSymbol()through the internal.removeMissingType(). (ThemissingTypeis also internal.)It might be too much to have both
.getTypeOfSymbol()and.getNonMissingTypeOfSymbol()in the public API. Perhaps.getTypeOfSymbol()could be used to call both via some option or flag (similar to.typeToString())?Or perhaps there is a solution that I could not figure out?