If I have a
type Mapping = Record<'success' | 'error', React.ReactNode>
, how can I extract the TypeScript type using the compiler API?
While the symbol for Mapping
has the expected two properties, the symbol for each property does not have a type specified.
For a structure like { success: React.ReactNode, error: React.ReactNode }, you can typically use
checker.getTypeOfSymbolAtLocation(symbol, symbol.declarations[0])
to access the type of each property. However, this approach does not seem to work for mapped types.