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
refactor type definitions #2323
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2323 +/- ##
==========================================
- Coverage 58.74% 54.89% -3.86%
==========================================
Files 259 145 -114
Lines 4380 2525 -1855
Branches 1157 755 -402
==========================================
- Hits 2573 1386 -1187
+ Misses 1806 1134 -672
- Partials 1 5 +4
Continue to review full report at Codecov.
|
Ping @paranoidjk |
@BANG88 👍 我看看。 加个微信吧, 我的 id: |
@@ -28,11 +37,19 @@ class ActionSheetAndroid extends React.Component<IActionSheetNativeProps, any> { | |||
visible: false, | |||
}); | |||
} | |||
|
|||
close = () => { |
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.
Looks like we have a bug here?
cc @silentcloud
@@ -7,6 +7,7 @@ | |||
"noUnusedLocals": true, | |||
"allowSyntheticDefaultImports":true, | |||
"target": "es6", | |||
"noImplicitAny": true, |
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.
So we can close #2147
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.
But i searched the codebase, there still have many any
left
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.
Yep. some of them needs enhancement.
@@ -124,68 +123,77 @@ | |||
"webpack-visualizer-plugin": "^0.1.11" | |||
}, | |||
"scripts": { | |||
"lint": "npm run tslint && npm run srclint && npm run demolint && npm run stylelint && npm run applint", | |||
"lint": | |||
"npm run tslint && npm run srclint && npm run demolint && npm run stylelint && npm run applint", |
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.
Why JSON value need to start at newline? looks like is unusual usage.
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.
Miss... formatted automatically by VSCode..
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.
Maybe because its too long for read. 😄
}); | ||
|
||
return ( | ||
<span className={badgeCls}> | ||
{children} | ||
{(text || dot) && <sup className={scrollNumberCls} {...restProps}>{text}</sup>} | ||
{(text || dot) && ( | ||
// tslint:disable-next-line:jsx-no-multiline-js |
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.
Maybe we can disable jsx-no-multiline-js
rules, since actually we have lots of usage like this.
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.
Should disable it via ant tools.
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.
I prefer prettier for code formatting.
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.
You can PR to https://github.com/ant-design/antd-tools/blob/master/lib/tslint.json to disable this rule. cc @yesmeck Do you argree to disable this in antd?
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.
Haha, prettier +1
@@ -120,7 +120,9 @@ export default class ImagePicker extends React.Component< | |||
this.parseFile(files[i], i); | |||
} | |||
} | |||
fileSelectorEl.value = ''; | |||
if (fileSelectorEl) { |
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.
I have merge #2302.
So that we may not need Defensive programming
here.
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.
It maybe null reference so need have a check here.
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.
Since merge #2302 fileSelectorEl
should always reference to input element instance once component mount.
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.
Yep but the type of ref
are Element | null
. TypeScript checker can not pass.
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.
Use fileSelectorEl!.value = '';
?Since if null check
is a runtime issue. If we only need to let ts compiler skip this, we may use exclamation mark.
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.
I don't like !
. may forget check for some reason sometimes
@@ -301,7 +300,7 @@ exports[`renders ./components/carousel/demo/basic.native.tsx correctly 1`] = ` | |||
"justifyContent": "center", | |||
}, | |||
Object { | |||
"backgroundColor": "red", | |||
"backgroundColor": "#ccc", |
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.
Why there is several snapshot change in this PR? I think type definition change should not have impact on ui.
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.
Agree. but i forgot why this has been changed. 😢
components/icon/index.tsx
Outdated
|
||
export interface IconPropType { | ||
type: string; | ||
export interface IconProps extends IconPropsType { |
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.
继承 SVGAttributes 吧 #2339
@BANG88 解决冲突。另外尽量只改类型不改业务逻辑,业务逻辑有问题需要改的的单独 PR。 |
* master: test: update snapshot ci: upgrade to nodejs 8 fix(Carousel): ant-design#2369 chore: delete upgrade tip fix: Fix all failed test (ant-design#2337) fix: modal.alert content align=center (ant-design#2347) bugfix: fixed bug in image-picker, Uncaught TypeError: Cannot set property 'value' of null (ant-design#2302) # Conflicts: # components/_util/upgradeTip.tsx # components/image-picker/index.tsx
👌 |
* refactor(util): noImplicitAny * refactor(accordion): type definitions improvements * refactor(action-sheet): add missing type definitions * chore: configuration * refactor(activity-indicator): type definitions * chore: configuration * refactor(badge): type definitions * refactor(button): type definitions * refactor(calendar): type definitions * refactor(card): type definitions * refactor(carousel): add type definitions and refactor native part * refactor(checkbox): type definitions * refactor(list): type definitions * refactor(date-picker): type definitions * refactor(date-picker-view): type definitions * refactor(drawer): type definitions * refactor(flex): type definitions * refactor(grid): type definitions * refactor(icon): type definitions * refactor(image-picker): type definitions * refactor(input-item): type definitions and code refactor * refactor(locale-provider): type definitions * refactor(menu): type definitions * refactor(modal): type definitions * refactor(nav-bar): type definitions * refactor(notice-bar): type definitions * refactor(pagination): type definitions * refactor(picker): type definitions * refactor(picker-view): type definitions * refactor(popover): type definitions * refactor(progress): type definitions * refactor(radio): type definitions * refactor(range): type definitions * refactor(result): type definitions * refactor(search-bar): type definitions * refactor(segmented-control): type definitions * refactor(slider): type definitions * refactor(stepper): type definitions * refactor(steps): type definitions * refactor(swipe-action): type definitions * refactor(switch): type definitions * refactor(tab-bar): type definitions * refactor(tabs): type definitions * refactor(tag): type definitions * refactor(view|text): type definitions * refactor(textarea-item): type definitions * refactor(toast): type definitions * refactor(white-space): type definitions * refactor(wing-blank): type definitions * refactor(list-view): type definitions * refactor(demo): any * chore(style): use ant-tools tslint configurations * test: update snapshots * chore: remove unnecessary configurations and deps * chore: tslint * chore: add setup file * fix: ant-design#2302 * test: update snap * chore: update deps and fix tests * chore: try to let jest faster * refactor(Icon): extends from SVG Props
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 :
Don't merge this is a WIP PR. since it have too many changes. PR here for discussion #2315This change is