I am getting from TSLint:
Multiple imports from 'moment' can be combined into one.
Guilty code:
import * as moment from 'moment'; import { Moment } from 'moment';
I have tried several variants without success (I have not found relevant example in docs):
import * as moment, { Moment } from 'moment'; import { * as moment, Moment } from 'moment'; import { * as moment, Moment as Moment } from 'moment';
Be careful because:
import * as moment from 'moment'
is different from
import moment from 'moment'
Because the second imports only the namespace moment and everything within, but the first imports everything including function moment() that is out of the namespace. Correct import can be:
import * as moment from 'moment'; type Moment = moment.Moment;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With