New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typescript 引用报错 #214
Comments
是不是和 rollup 打包的方式有关系? ts 的标准我一直没搞明白 |
这个在 tsconfig 里设置 "allowSyntheticDefaultImports": true 就好了 |
谢谢,这个开关开上了,但还是一样的。目前的 tsconfig 配置,是在 nestjs 自动生成的基础上稍加改动的。
代码中避免语法错误提示,是这么写的
|
项目的tsconfig配置: {
"compileOnSave": true,
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"inlineSourceMap":true,
"noImplicitThis": true,
"noUnusedLocals": false,
"stripInternal": true,
"skipLibCheck": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"pretty": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [ "./typings", "./node_modules/@types"],
"outDir": "dist"
},
"exclude": [
"dist",
"node_modules",
"test"
]
}
|
你再研究下ts配置和构建配置吧,看起来和 gcoord 本身没关系,这个我 close 了 |
多谢 语法提示是没问题的。编译运行会报错,应该和 gcoord 的 rollup 配置有关系。 |
我新建了一个 nestjs 的项目试了下,需要在 tsconfig 中配置 "esModuleInterop": true,tsconfig 的配置如下: {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"esModuleInterop": true,
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
}
这样类型提示和运行都没问题了。 这应该是不同模块规范冲突的问题,我近期修复一下 |
赞
解决问题了 |
在 ts 工程中,这么写会报错
编译出来的代码会发现 gcoord 找不到
必须改成这样才行
改成这样后,语法提示又出错了。比较别扭,不知道是哪里的问题。
The text was updated successfully, but these errors were encountered: