microsoft / microsoft/azure-devops-extension-sdk

Getting an error when i create react based Azure Devops Table with check box

Open
#39 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
159
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Table columns used
export const checkboxColumns = [
new ColumnSelect(),
{
id: "name", name: "Name", readonly: true, renderCell: renderSimpleCell, width: new ObservableValue(-30),
},
{
id: "age", name: "Age", readonly: true, renderCell: renderSimpleCell, width: new ObservableValue(-30),
},
{
id: "gender", name: "Gender", readonly: true, renderCell: renderSimpleCell, width: new ObservableValue(-40),
},
];
Error Message Prompted
TS2322: Type '(ColumnSelect | { id: string; name: string; readonly: boolean; renderCell: (rowIndex: number, columnIndex: number, tableColumn: ITableColumn, tableItem: T, ariaRowIndex?: number | undefined) => Element; width: ObservableValue<...>; })[]' is not assignable to type 'ITableColumn[]'.
Type 'ColumnSelect | { id: string; name: string; readonly: boolean; renderCell: (rowIndex: number, columnIndex: number, tableColumn: ITableColumn, tableItem: T, ariaRowIndex?: number | undefined) => Element; width: ObservableValue<...>; }' is not assignable to type 'ITableColumn'.
Type 'ColumnSelect' is not assignable to type 'ITableColumn'.
Types of property 'behaviors' are incompatible.
Type 'IBehavior<ITableColumnBehaviorProps<{}>, {}>[]' is not assignable to type 'IBehavior<ITableColumnBehaviorProps, {}>[]'.
Type 'IBehavior<ITableColumnBehaviorProps<{}>, {}>' is not assignable to type 'IBehavior<ITableColumnBehaviorProps, {}>'.
Types of property 'initialize' are incompatible.
Type '((props: Readonly<ITableColumnBehaviorProps<{}>>, component: {}, eventDispatch: IEventDispatch) => void) | undefined' is not assignable to type '((props: Readonly<ITableColumnBehaviorProps>, component: {}, eventDispatch: IEventDispatch) => void) | undefined'.
Type '(props: Readonly<ITableColumnBehaviorProps<{}>>, component: {}, eventDispatch: IEventDispatch) => void' is not assignable to type '(props: Readonly<ITableColumnBehaviorProps>, component: {}, eventDispatch: IEventDispatch) => void'.
Types of parameters 'props' and 'props' are incompatible.
Type 'Readonly<ITableColumnBehaviorProps>' is not assignable to type 'Readonly<ITableColumnBehaviorProps<{}>>'.
Types of property 'tableProps' are incompatible.
Type 'Partial<ITableProps>' is not assignable to type 'Partial<ITableProps<{}>>'.

Code for Table Creation
import * as React from "react";
import { checkboxColumns, tableItems } from "./TableData";
import { ListSelection } from "azure-devops-ui/List";
import { Card } from "azure-devops-ui/Card";
import { Table } from "azure-devops-ui/Table";

export default class TableCheckboxExample extends React.Component {
private selection = new ListSelection({ selectOnFocus: true, multiSelect: true });

public render(): JSX.Element {
    return (
        <Card className="flex-grow bolt-table-card" contentProps={{ contentPadding: false }}>
            <Table
                ariaLabel="Table with checkboxes"
                className="table-example"
                columns={checkboxColumns}
                containerClassName="h-scroll-auto"
                itemProvider={tableItems}
                selection={this.selection}
                role="table"
            />
        </Card>
    );
}

}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the checkboxColumns definition in TableData and the TableCheckboxExample entry point, then reproduce the TypeScript error when passing columns to Table. Trace the generic types used by ColumnSelect and Table's columns prop. Done means the checkbox table compiles with the shown columns and preserves the intended table behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.