I want to iterate over all module exports to extract their types.
I assume that during compile time this information would be available
export const a = 123;
export const b = 321;
// Is there any way to do something like this in typescript/javascript es6?
console.log(module.exports)
// { a: 123, b: 321 }
Edit: I would like to share the solution to the issue I mentioned on the first line.
Thanks for the answer, but it appears I was wrong to restrict it to a single file altogether. I created a separate types.ts and used 'utility-types' library for the relevant type manipulations
import { ValuesType } from 'utility-types';
import * as myModue from './myModule';
export IMyModuleType = ValuesType<typeof myModue>;
And then just imported the type with the new 3.8 syntax
import type { IMyModuleType } from './types';
//...