-
Notifications
You must be signed in to change notification settings - Fork 274
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
build时声明文件typings.d.ts需要在哪里配置 #48
Comments
没明白问题,这应该是 TypeScript 的使用问题。 |
我的tsconfig.json配置是这样的
"typings/index.d.ts" 配置是这样的 noImplicitAny设置成false可以解决,但是, "typings/index.d.ts"这里面不是写声明了,为什么build 当设置 .fatherrc esm:'rollup' namedExports配置不生效 |
declare module "dom-helpers"; 这样从 dom-helpers 导出的模块都是any类型, 要么 就设置为false,要么详细定义 declare module "dom-helpers" ? |
father-build读取声明文件typings.d.ts无效 "father-build": "^1.13.2"
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "esnext",
"target": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"jsx": "react",
"esModuleInterop": true,
"declaration": true,
"noImplicitAny": false
},
"include": ["./packages", "./typings/"],
"typings": "./typings/index.d.ts",
"exclude": [
"node_modules",
"dist",
"scripts",
"build",
"jest",
"**/*.spec.ts",
"es",
"lib",
"fixtures",
"examples"
]
}
declare module '*.css'
declare module '*.less'
declare module '*.scss'
declare module '*.svg'
|
遇到一样的问题;如果说typings/index.d.ts未生效,但是vscode编辑器的确是没有报红线错误,只是father build的时候仍然会报错。怎么试都不行,这是ts的使用问题还是 father build的问题? |
@aweiu 用你的 /// 方式解决了打包失败的问题 |
入口文件增加d.ts文件说明 umijs/father#48 (comment)
还没有解决吗 |
dumi 中打包同样问题,使用的是 babel 模式 |
同 dumi 打包同样问题,babel模式 |
用这种方式改了,还是一样报错,并没解决问题 |
请问大家解决了吗?如何解决呢? |
这是 father 2 的 issue,father 4 直接项目根目录创建全局 d.ts 即可,以及如果 tsconfig.json 里配了 include 要确保 include 包含这个 d.ts |
build报错
error TS7016: Could not find a declaration file for module 'dom-helpers'. 'E:/nodeproject/ds/node_modules/_dom-helpers@3.4.0@dom-helpers/index.js' implicitly has an 'any' type.
The text was updated successfully, but these errors were encountered: