Browse Source

Updating type: TreeSelectProps.getPopupContainer (#14443)

TreeSelectProps extends AbstractSelectProps. However, the method signatures are different causing compilation issue with typescript:


```
Failed to compile.

/home/kasra/Desktop/Repos/frontend/node_modules/antd/lib/tree-select/interface.d.ts
Type error: Interface 'TreeSelectProps' incorrectly extends interface 'AbstractSelectProps'.
  Types of property 'getPopupContainer' are incompatible.
    Type '((triggerNode: Element) => HTMLElement) | undefined' is not assignable to type '((triggerNode?: Element | undefined) => HTMLElement) | undefined'.
      Type '(triggerNode: Element) => HTMLElement' is not assignable to type '(triggerNode?: Element | undefined) => HTMLElement'.
        Types of parameters 'triggerNode' and 'triggerNode' are incompatible.
          Type 'Element | undefined' is not assignable to type 'Element'.
            Type 'undefined' is not assignable to type 'Element'.  TS2430

    24 |     rootPId?: string;
    25 | }
  > 26 | export interface TreeSelectProps extends AbstractSelectProps {
       |                  ^
    27 |     autoFocus?: boolean;
    28 |     defaultValue?: string | number | Array<any>;
```
pull/14467/head
Kasra Bigdeli 6 years ago
committed by zombieJ
parent
commit
4e116962f2
  1. 2
      components/tree-select/interface.tsx

2
components/tree-select/interface.tsx

@ -34,7 +34,7 @@ export interface TreeSelectProps extends AbstractSelectProps {
defaultValue?: string | number | Array<any>; defaultValue?: string | number | Array<any>;
dropdownStyle?: React.CSSProperties; dropdownStyle?: React.CSSProperties;
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean; filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
getPopupContainer?: (triggerNode: Element) => HTMLElement; getPopupContainer?: (triggerNode?: Element) => HTMLElement;
labelInValue?: boolean; labelInValue?: boolean;
loadData?: (node: any) => void; loadData?: (node: any) => void;
maxTagCount?: number; maxTagCount?: number;

Loading…
Cancel
Save