How can I write this on 1 line?
import * as Express from \'express\';
import { Application, NextFunction, Request, Response } from \'express\';
<
import
and export
have restricted syntax that allows to statically analyze them:
As listed in the documentation:
import defaultMember from "module-name";
import * as name from "module-name";
import { member } from "module-name";
import { member as alias } from "module-name";
import { member1 , member2 } from "module-name";
import { member1 , member2 as alias2 , [...] } from "module-name";
import defaultMember, { member [ , [...] ] } from "module-name";
import defaultMember, * as name from "module-name";
import "module-name";
As it can be seen, there's no import * as name, { member } from "module-name"
, so it isn't supported.
The reason why it isn't supported is because import * as name, { member } from "module-name"
are interchangeable. It's either importing members one by one or as name
namespace.
If both should be used for some reason, it should be:
import * as Express from 'express';
import { Application, NextFunction, Request, Response } from 'express';
Or if exports are real variables and not types/interfaces, it can be:
import * as Express from 'express';
const { Application, NextFunction, Request, Response } = Express;