ElemeFE / element-react

Element UI
https://elemefe.github.io/element-react/index
MIT License
2.83k stars 443 forks source link

"defaultExpandAll" property was not defined in typing/index.d.ts #1021

Open zhengyhn opened 4 years ago

zhengyhn commented 4 years ago

Description

"defaultExpandAll" property was not defined in typing/index.d.ts

Reproduce Steps

  1. Write down <Table defaultExpandAll={true}/>
  2. Compile, tsc will have compiled error

Error Trace (if possible)

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<TableProps>): Table', gave the following error.
    Type '{ style: { width: string; }; columns: ({ type: string; expandPannel: (data: any) => Element; label?: undefined; prop?: undefined; width?: undefined; } | { label: string; prop: string; width: number; type?: undefined; expandPannel?: undefined; } | { ...; })[]; data: { ...; }[]; border: false; defaultExpandAll: boolea...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Table> & Readonly<TableProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'defaultExpandAll' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Table> & Readonly<TableProps> & Readonly<{ children?: ReactNode; }>'.
  Overload 2 of 2, '(props: TableProps, context?: any): Table', gave the following error.
    Type '{ style: { width: string; }; columns: ({ type: string; expandPannel: (data: any) => Element; label?: undefined; prop?: undefined; width?: undefined; } | { label: string; prop: string; width: number; type?: undefined; expandPannel?: undefined; } | { ...; })[]; data: { ...; }[]; border: false; defaultExpandAll: boolea...' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Table> & Readonly<TableProps> & Readonly<{ children?: ReactNode; }>'.
      Property 'defaultExpandAll' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Table> & Readonly<TableProps> & Readonly<{ children?: ReactNode; }>'.  TS2769

Solution

Add defaultExpandAll to the interface TableProps.

  interface TableProps extends ElementReactLibs.ComponentProps<{}> {
    columns?: TableColumn[]
    data?: Object[]
    height?: number
    stripe?: boolean
    border?: boolean
    fit?: boolean
    rowClassName?(row?, index?): void
    style?: Object
    highlightCurrentRow?: boolean
    // defaultExpandAll?: boolean
    onCurrentChange?(): void
    onSelectAll?(): void
    onSelectChange?(): void
  }

Additional Information