Module name type, or autocompletion

31 Views Asked by At

In Typescript, I can write

let mod = await import("redis");

and get auto-completion for all modules when entering a value for the import. Is this a special case, or can I get the same behavior using a type on a function that I define, like

let my_import = (module: ???) => import(module)

or is there another way to get module name auto-completion?

1

There are 1 best solutions below

2
Bergi On

Yes, this is a special case. import() is not a function call, and import is not a function - it is specific syntax.