我试图让 Gatsby 使用 TypeScript,按照此处的说明进行操作,但由于某种原因,tsc
它没有转换其余 ( ...
) 运算符,而是引发以下错误:
WAIT Compiling...
ERROR Failed to compile with 1 errors
error in ./src/components/Input.tsx
Syntax Error: Unexpected token (26:95)
> 26 | const Input = ({ text, ...inputProps }) => (react_1.default.createElement(
| ^
如果我从命令行运行tsc
,则文件被正确编译,替换...
为对__rest
.
这是我的tsconfig.json
:
{
"compilerOptions": {
"outDir": "./dist/"
},
"include": [
"./src/**/*"
]
}
如您所见,它非常小。我尝试使用一堆lib
s (来自Compiler Options)和其他选项,但似乎没有任何效果。