-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[WIP] add tslint type check test #1560
Conversation
@cncolder, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pingan1927, @yiminghe and @paranoidjk to be potential reviewers. |
* fix ant-design#1486 modify the implementation of image-picker ref * fix: remove unuse operator
* feat: pagination current start from 1. close ant-design#1009 * refactor style for some components, ref ant-design#1380 * fix flex ant-design#1532 * update snap * modify CHANGELOG
Codecov Report
@@ Coverage Diff @@
## feature-2.0 #1560 +/- ##
===============================================
+ Coverage 66.1% 66.15% +0.04%
===============================================
Files 226 226
Lines 2269 2272 +3
Branches 696 699 +3
===============================================
+ Hits 1500 1503 +3
Misses 768 768
Partials 1 1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## feature-2.0 #1560 +/- ##
===============================================
- Coverage 66.1% 65.32% -0.79%
===============================================
Files 226 120 -106
Lines 2269 2163 -106
Branches 696 604 -92
===============================================
- Hits 1500 1413 -87
+ Misses 768 749 -19
Partials 1 1
Continue to review full report at Codecov.
|
9003964
to
f9649b4
Compare
try refactoring list type definition
@@ -1,74 +1,77 @@ | |||
import React, { ReactNode } from 'react'; | |||
import React from 'react'; | |||
import ReactNative from 'react-native'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里还是会导致一个目前已知的问题
- 使用 web 组件的用户需要安装 react-native 依赖
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个很好解决,WebProps 和 NativeProps 移到各自的组件里。
类型定义在需要的地方没什么不可以的,因为我们本来就是个 typescript 项目。 PropsType.tsx
存在的意义是重用代码,而且 PropsType 这个文件名也待考量,我们使用 typescript 的目的不能只局限于 React props type 验证这个低起点上。
@@ -0,0 +1,34 @@ | |||
import List from 'antd-mobile/lib/list'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按你这个改法,这一行 https://github.com/ant-design/ant-design-mobile/blob/feature-2.0/components/index.tsx#L1 的注释可以去掉了,umd dist 打包的入口和 types 文件生成的入口已经拆分开了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个不是改动,是因为我只试着重写了 List 的类型定义,全部导入的话测试通不过,这个文件是为了 tslint --type-check
用的。
用户还是要 import {} from 'antd-mobile'
@@ -11,7 +11,8 @@ | |||
"exclude": [ | |||
"node_modules", | |||
"lib", | |||
"es" | |||
"es", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还要改 Pkg.typings
吧?默认指向 web 的类型文件,rn的用户就按照 ant-design/antd-mobile-samples#21
自定义 tsconfig 指向 native 的类型文件
@cncolder https://github.com/ant-design/ant-design-mobile/tree/master -> 2.x 直接往 master 合吧。 |
try refactoring list type definition
This pr use for discussion. Working in progress. DONOT merge.
ref #1557
ref ant-design/antd-mobile-samples#21
After this pr. React Native user need update
tsconfig.json
Once you finish configure path mapping. You will get nearly perfect vscode IntelliSense for List component.
First of all, thank you for your contribution! :-)
Please makes sure that these checkboxes are checked before submitting your PR, thank you!
npm run lint
and fix those errors before submitting in order to keep consistent code style.Extra checklist:
if isBugFix :
elif isNewFeature :
This change is