Skip to content

fix: update components type #3165

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

Merged
merged 1 commit into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/auto-complete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import warning from '../_util/warning';

const { Option, OptGroup } = Select;

function isSelectOptionOrSelectOptGroup(child: any): Boolean {
return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
function isSelectOptionOrSelectOptGroup(child: any): boolean {
return child?.type?.isSelectOption || child?.type?.isSelectOptGroup;
}

const AutoCompleteProps = {
Expand Down Expand Up @@ -83,12 +83,12 @@ const AutoComplete = defineComponent({

render() {
const { size, prefixCls: customizePrefixCls, dataSource } = this;
let optionChildren: any;
let optionChildren: VNode[];
const { getPrefixCls } = this.configProvider;
const prefixCls = getPrefixCls('select', customizePrefixCls);
const { class: className } = this.$attrs as any;
const { class: className } = this.$attrs;
const cls = {
[className]: !!className,
[className as string]: !!className,
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-show-search`]: true,
Expand Down
7 changes: 1 addition & 6 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,7 @@ export default defineComponent({
},

render() {
const {
prefixCls: customizePrefixCls,
title,
component: Tag = 'sup' as any,
displayComponent,
} = this;
const { prefixCls: customizePrefixCls, title, component: Tag = 'sup', displayComponent } = this;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('scroll-number', customizePrefixCls);
const { class: className, style = {} } = this.$attrs as {
Expand Down
4 changes: 2 additions & 2 deletions components/cascader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function defaultSortFilteredOption(
inputValue: string,
names: FilledFieldNamesType,
) {
function callback(elem) {
function callback(elem: CascaderOptionType) {
return elem[names.label].indexOf(inputValue) > -1;
}

Expand Down Expand Up @@ -327,7 +327,7 @@ const Cascader = defineComponent({
},

handleInputChange(e: Event) {
const inputValue = (e.target as any).value;
const inputValue = (e.target as HTMLInputElement).value;
this.setState({ inputValue });
this.$emit('search', inputValue);
},
Expand Down
4 changes: 2 additions & 2 deletions components/collapse/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export default defineComponent({
const { prefixCls: customizePrefixCls, bordered, expandIconPosition } = this;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
const { class: className, ...restAttrs } = this.$attrs as any;
const { class: className, ...restAttrs } = this.$attrs;
const collapseClassName = {
[className]: className,
[className as string]: className,
[`${prefixCls}-borderless`]: !bordered,
[`${prefixCls}-icon-position-${expandIconPosition}`]: true,
};
Expand Down
4 changes: 2 additions & 2 deletions components/collapse/CollapsePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default defineComponent({
const { prefixCls: customizePrefixCls, showArrow = true } = this;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('collapse', customizePrefixCls);
const { class: className, ...restAttrs } = this.$attrs as any;
const { class: className, ...restAttrs } = this.$attrs;
const collapsePanelClassName = {
[className]: className,
[className as string]: className,
[`${prefixCls}-no-arrow`]: !showArrow,
};

Expand Down
4 changes: 2 additions & 2 deletions components/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const Drawer = defineComponent({
const handler = getComponent(this, 'handle') || false;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
const { class: className } = this.$attrs as any;
const { class: className } = this.$attrs;
const vcDrawerProps: any = {
...this.$attrs,
...omit(rest, [
Expand Down Expand Up @@ -253,7 +253,7 @@ const Drawer = defineComponent({
showMask: mask,
placement,
class: classnames({
[className]: !!className,
[className as string]: !!className,
[wrapClassName]: !!wrapClassName,
[haveMask]: !!haveMask,
}),
Expand Down
4 changes: 2 additions & 2 deletions components/form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const FormProps = {
prefixCls: PropTypes.string,
hideRequiredMark: PropTypes.looseBool,
model: PropTypes.object,
rules: { type: Object as PropType<{[k: string]: ValidationRule[] | ValidationRule}> },
rules: { type: Object as PropType<{ [k: string]: ValidationRule[] | ValidationRule }> },
validateMessages: PropTypes.object,
validateOnRuleChange: PropTypes.looseBool,
// 提交失败自动滚动到第一个错误字段
Expand All @@ -63,7 +63,7 @@ export const FormProps = {
validateTrigger: { type: [String, Array] as PropType<string | string[]> },
};

function isEqualName(name1: any, name2: any) {
function isEqualName(name1: NamePath, name2: NamePath) {
return isEqual(toArray(name1), toArray(name2));
}

Expand Down
2 changes: 1 addition & 1 deletion components/input/ResizableTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const ResizableTextArea = defineComponent({
saveTextArea(textArea: HTMLTextAreaElement) {
this.textArea = textArea;
},
handleResize(size: any) {
handleResize(size: { width: number; height: number }) {
const { resizeStatus } = this.$data;

if (resizeStatus !== RESIZE_STATUS_NONE) {
Expand Down
2 changes: 1 addition & 1 deletion components/input/calculateNodeHeight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function calculateNodeHeight(
let minHeight = Number.MIN_SAFE_INTEGER;
let maxHeight = Number.MAX_SAFE_INTEGER;
let height = hiddenTextarea.scrollHeight;
let overflowY: any;
let overflowY: string;

if (boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
Expand Down