I aim to extract the types of all module exports by iterating through them.
I believe that this information should be accessible during compile time
export const a = 123;
export const b = 321;
// Is there a way to achieve something similar in TypeScript/JavaScript ES6?
console.log(module.exports)
// { a: 123, b: 321 }
Edit: I wanted to provide the solution to the problem I mentioned earlier.
Thank you for the response, although it seems my mistake was limiting it to just one file. I made a separate types.ts
and used the 'utility-types' library for the necessary type operations
import { ValuesType } from 'utility-types';
import * as myModule from './myModule';
export IMyModuleType = ValuesType<typeof myModule>;
Then I simply imported the type using the new 3.8 syntax
import type { IMyModuleType } from './types';
//...