Reputation:
I am getting error when compile the code
import * as moment from "moment";
Compilation error
ERROR in [at-loader] ./project/src/common/common.factory.spec.ts:72:40 TS2709: Cannot use namespace 'moment' as a type.
Any suggestion, please.
Upvotes: 1
Views: 3985
Reputation: 317
You need to import moment without alias.
import moment from 'moment';
Also, you might need to add the option allowSyntheticDefaultImports and set it to true in your tsconfig.json file
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
}
}
Upvotes: 1