import "type" and "different variable" in one single line

I am new to Typescript. Currently I am trying to use TypeScript in an electron app(just practice TypeScript).

In my app I need to import a "type" and a "variable/class" in to my app from electron package, but currently I am doing it this way:

import { dialog } from 'electron';
import type { BrowserWindowConstructorOptions } from 'electron';

Is there a way I can make it one line while still clearly show what I am importing(a "type" or a "variable/class")?

I know that I can do something like this:

import { dialog ,BrowserWindowConstructorOptions } from 'electron';

but with above code, it's not clear what I am importing, it's hard to tell if the "dialog" I am importing is a type or a variable.


  • To specify type for selected imports, you may use type keyword before the imported name:

    import { dialog, type BrowserWindowConstructorOptions } from 'electron';

    This is documented under Modules - Reference > Module Syntax > Type-only imports and exports section in TypeScript docs.