Skip to content
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

fix: incorrect generated dts in useFieldSchema #2350

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

hjkcai
Copy link
Contributor

@hjkcai hjkcai commented Oct 26, 2021

Before submitting a pull request, please make sure the following is done...

  • Ensure the pull request title and commit message follow the Commit Specific in English.
  • Fork the repo and create your branch from master or formily_next.
  • If you've added code that should be tested, add tests!
  • If you've changed APIs, update the documentation.
  • Ensure the test suite passes (npm test).
  • Make sure your code lints (npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.

Please do not delete the above content


What have you changed?

The generated dts file of @formily/react@2.0.0-rc.17 is incorrect because it has a module reference to package/json-schema/esm, which cannot be found outside the main monorepo project of formily.

export declare const useFieldSchema: () => import("packages/json-schema/esm").Schema<any, any, any, any, any, any, any, any, any>;

This PR changes the module reference to @formily/json-schema.

import { Schema } from '@formily/json-schema';
export declare const useFieldSchema: () => Schema;

@CLAassistant
Copy link

CLAassistant commented Oct 26, 2021

CLA assistant check
All committers have signed the CLA.

@janryWang
Copy link
Collaborator

janryWang commented Oct 26, 2021

https://github.com/alibaba/formily/blob/formily_next/packages/react/src/shared/context.ts#L3 这里就是通过包引入的方式呀,应该不是这个问题吧

@hjkcai
Copy link
Contributor Author

hjkcai commented Oct 26, 2021

@janryWang 应该是跨文件了,TS 会重新去查找这个类型的引用路径吧。

monorepo 场景下,TS 的路径解析不总是按照 tsconfig 里面配好的 paths 来解析的。在用 vscode 的 auto import 时应该也有类似的感觉才对。比如有的时候想从 @formily/json-schema 引,vscode 自动给出的路径却是 packages/json-schema/esm 之类的。

这是 TS 的历史遗留问题了,要让 TS 解决比较难,还是咱们自己规避一下吧。

@hjkcai
Copy link
Contributor Author

hjkcai commented Oct 26, 2021

PS. Github Actions 一直不动,求帮看下

@janryWang
Copy link
Collaborator

PR标题不符合规范

@hjkcai hjkcai changed the title fix incorrect generated dts in useFieldSchema fix: incorrect generated dts in useFieldSchema Oct 26, 2021
@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #2350 (9ef3d3b) into formily_next (fada235) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##           formily_next    #2350   +/-   ##
=============================================
  Coverage         95.31%   95.31%           
=============================================
  Files               140      140           
  Lines              6120     6120           
  Branches           1543     1543           
=============================================
  Hits               5833     5833           
  Misses              282      282           
  Partials              5        5           
Impacted Files Coverage Δ
packages/react/src/hooks/useFieldSchema.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fada235...9ef3d3b. Read the comment docs.

@janryWang janryWang merged commit e878103 into alibaba:formily_next Oct 26, 2021
@hjkcai
Copy link
Contributor Author

hjkcai commented Oct 26, 2021

是否可以考虑先发一版?因为这个问题是会让使用了受影响版本的项目无法编译通过的~ 感谢感谢

@janryWang
Copy link
Collaborator

先skipCheckLib吧

@hjkcai
Copy link
Contributor Author

hjkcai commented Nov 2, 2021

虽然 ts 可以 skipLibCheck,但是我们项目在 eslint 里面也开启了禁止 any 的一系列规则(@typescript-eslint/no-unsafe-assignment),类型错误会被解析为 any,从而导致 CI 失败。

可以的话还是麻烦尽快发版吧,感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants