1

Could not use moment methods like moment().utc().format() shows below error message.

TS2349: This expression is not callable.
Type 'typeof import("/nxdev/unified-ai/node_modules/moment/ts3.1- 
typings/moment.d.ts")' has no call signatures.

I tried to import moment as

import * as moment from 'moment';

moment version: 2.29.4
node version: 18.14.0.

Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38
joe
  • 365
  • 1
  • 5
  • 16

1 Answers1

1

according to this section in the Typescript docs

When exporting a module using export =, TypeScript-specific import module = require("module") must be used to import the module.

so here since they are exporting with export = in the provided package you have to import this way

const moment = require('moment'); 
Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38