【发布时间】:2019-06-01 00:37:49
【问题描述】:
我正在使用以下软件包版本:
- 下一个 v8.1.1-canary.42
- @types/next v8.0.5
server.js
import next from 'next';
const app = next({ dev: isDevelopment });
tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve",
"lib": ["dom", "es2017"],
"module": "commonjs",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules"]
}
我收到以下 Typescript 错误:
Cannot invoke an expression whose type lacks a call signature. Type 'typeof import(".../node_modules/next/types/index")' has no compatible call signatures.
我不明白这里发生了什么。谁能帮助解释这个错误以及为什么这个流行包的核心功能之一会抛出它?我是否需要为缺少的东西手动扩展一些 Next 类型?
【问题讨论】:
标签: javascript typescript next.js