'What is the type/class of a dynamically imported module in typescript?

I have problem finding the type of an imported module in typescript, could someone help me? To clarify my question I have a module module.ts

export class RSL1 {};

Then I load it in my index.ts with

const script =  await import('module.js');

It loads correctly and in a browser in debug console it is printed out as Module {Symbol(Symbol.toStringTag): "Module"}

But what is the typescript type of the script variable? The Module class is not known to the compiler. I need just the generic abstract type of the module, not the "runtime" instance. I guess the members of the module depend on what is actually exported in the module. But I don't need that.



Solution 1:[1]

For now it's 'object', as stated in this GitHub issue:

We currently don't have a way to represent values with properties that aren't inherited from Object. A solution for this would ideally also be usable to fix Object.create(null)

This affects all exotic objects that deviate from default prototype inheritance.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cachius