Using Typescript 3.* and momentjs for dates and I got compile time errors.
Error:(3, 13) TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof moment' has no compatible call signatures.
so,I looked for a solution to solve this error. And find the following article, I did the same thing as the solution described in the article.
but I got compile time error, again.
Error:(1, 8) TS1192: Module '"/Users/hogehoge/Work/Work_Fork/hoge/node_modules/moment/moment"' has no default export.
Here is My tsconfig and my programs.
{
"compilerOptions": {
"moduleResolution": "node",
"skipLibCheck": false,
"target": "es5",
"module": "commonjs",
"lib": ["es2017", "dom"],
"experimentalDecorators": true,
"allowJs": false,
"jsx": "react",
"sourceMap": true,
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"removeComments": true,
"newLine": "LF",
"downlevelIteration": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": false
},
"exclude": ["node_modules"]
}
import moment from 'moment';
console.log(moment().format('YYYY-MM-DD'))