Skip to content
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

chore(typescript): Remove data-frame exclusion from tsconfig #1489

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

schloerke
Copy link
Collaborator

@schloerke schloerke commented Jul 2, 2024

Initial errors:

➜  npm run build

> build
> npm run lint && npm run bundle


> lint
> tsc -noEmit && eslint .

data-frame/cell.tsx:202:11 - error TS2532: Object is possibly 'undefined'.

202       if (coldefs[newColumnIndex].meta!.isHtmlColumn !== true) {
              ~~~~~~~~~~~~~~~~~~~~~~~

data-frame/cell.tsx:242:28 - error TS2532: Object is possibly 'undefined'.

242     const targetRowIndex = rowModel.rows[nextSortedRowIndex].index;
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

data-frame/cell.tsx:480:7 - error TS2722: Cannot invoke an object which is possibly 'undefined'.

480       window.Shiny.unbindAll(curTdRef);
          ~~~~~~~~~~~~~~~~~~~~~~

data-frame/data-update.tsx:82:31 - error TS7031: Binding element 'rowIndex' implicitly has an 'any' type.

82         newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                                 ~~~~~~~~

data-frame/data-update.tsx:82:41 - error TS7031: Binding element 'columnIndex' implicitly has an 'any' type.

82         newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                                           ~~~~~~~~~~~

data-frame/data-update.tsx:82:54 - error TS7031: Binding element 'value' implicitly has an 'any' type.

82         newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                                                        ~~~~~

data-frame/data-update.tsx:83:11 - error TS2532: Object is possibly 'undefined'.

83           draft[rowIndex][columnIndex] = value;
             ~~~~~~~~~~~~~~~

data-frame/data-update.tsx:86:29 - error TS7031: Binding element 'rowIndex' implicitly has an 'any' type.

86       newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                               ~~~~~~~~

data-frame/data-update.tsx:86:39 - error TS7031: Binding element 'columnIndex' implicitly has an 'any' type.

86       newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                                         ~~~~~~~~~~~

data-frame/data-update.tsx:86:52 - error TS7031: Binding element 'value' implicitly has an 'any' type.

86       newPatches.forEach(({ rowIndex, columnIndex, value }) => {
                                                      ~~~~~

data-frame/filter.tsx:37:23 - error TS7006: Parameter 'row' implicitly has an 'any' type.

37           substring: (row, columnId, value, addMeta) => {
                         ~~~

data-frame/filter.tsx:37:28 - error TS7006: Parameter 'columnId' implicitly has an 'any' type.

37           substring: (row, columnId, value, addMeta) => {
                              ~~~~~~~~

data-frame/filter.tsx:37:38 - error TS7006: Parameter 'value' implicitly has an 'any' type.

37           substring: (row, columnId, value, addMeta) => {
                                        ~~~~~

data-frame/filter.tsx:37:45 - error TS7006: Parameter 'addMeta' implicitly has an 'any' type.

37           substring: (row, columnId, value, addMeta) => {
                                               ~~~~~~~

data-frame/index.tsx:120:11 - error TS2339: Property 'styles' does not exist on type 'DataGridOptions'.

120   const { styles } = payloadOptions;
              ~~~~~~

data-frame/index.tsx:121:34 - error TS2551: Property 'styles' does not exist on type 'DataGridOptions'. Did you mean 'style'?

121   const styles2 = payloadOptions["styles"];
                                     ~~~~~~~~

data-frame/index.tsx:124:36 - error TS2551: Property 'styles' does not exist on type 'DataGridOptions'. Did you mean 'style'?

124     initStyleInfos: payloadOptions["styles"],
                                       ~~~~~~~~

data-frame/index.tsx:151:30 - error TS7053: Element implicitly has an 'any' type because expression of type '"editable"' can't be used to index type 'DataGridOptions'.
  Property 'editable' does not exist on type 'DataGridOptions'.

151   const editCellsIsAllowed = payloadOptions["editable"] === true;
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~

data-frame/index.tsx:343:25 - error TS2532: Object is possibly 'undefined'.

343       const targetKey = rowModel.rows[index].id;
                            ~~~~~~~~~~~~~~~~~~~~

data-frame/index.tsx:431:11 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.

431           id: columns[sort.col],
              ~~

  node_modules/@tanstack/table-core/build/lib/features/Sorting.d.ts:7:5
    7     id: string;
          ~~
    The expected type comes from property 'id' which is declared here on type 'ColumnSort'

data-frame/index.tsx:465:11 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.

465           id: columns[filter.col],
              ~~

  node_modules/@tanstack/table-core/build/lib/features/Filters.d.ts:11:5
    11     id: string;
           ~~
    The expected type comes from property 'id' which is declared here on type 'ColumnFilter'

data-frame/index.tsx:527:20 - error TS2532: Object is possibly 'undefined'.

527             return rowsById[key].index;
                       ~~~~~~~~~~~~~

data-frame/index.tsx:601:18 - error TS2532: Object is possibly 'undefined'.

601           return rowsById[key].index;
                     ~~~~~~~~~~~~~

data-frame/index.tsx:685:19 - error TS2322: Type '{ children: (false | Element | Element[])[]; key: string; "aria-rowindex": number; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>'.
  Property 'key' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>'.

685               <tr key={headerGroup.id} aria-rowindex={i + 1}>
                      ~~~

data-frame/index.tsx:710:23 - error TS2322: Type '{ children: Element | undefined; key: string; colSpan: number; style: { width: number; }; scope: string; tabIndex: number; onClick: ((event: unknown) => void) | undefined; onKeyDown: (event: KeyboardEvent<Element>) => void; }' is not assignable to type 'DetailedHTMLProps<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>'.
  Property 'key' does not exist on type 'DetailedHTMLProps<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>'.

710                       key={header.id}
                          ~~~

data-frame/index.tsx:729:25 - error TS2322: Type '{ children: Element; key: string; }' is not assignable to type 'DetailedHTMLProps<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>'.
  Property 'key' does not exist on type 'DetailedHTMLProps<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>'.

729                     <th key={`filter-${header.id}`}>
                            ~~~

data-frame/index.tsx:748:21 - error TS2322: Type '{ children: (false | Element | Element[])[]; onMouseDown: (event: MouseEvent<HTMLTableRowElement, MouseEvent>) => void; ... 7 more ...; tabIndex: number; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>'.
  Property 'key' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>'.

748                     key={virtualRow.key}
                        ~~~

data-frame/index.tsx:828:15 - error TS2532: Object is possibly 'undefined'.

828     keys.push(rowModel.rows[i].id);
                  ~~~~~~~~~~~~~~~~

data-frame/index.tsx:883:20 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'ShinyDataGridServerInfo<unknown> | null'.

883     el.renderValue(data);
                       ~~~~

data-frame/index.tsx:914:53 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.

914   if (bgColor === "transparent" || (m && parseFloat(m[4]) === 0)) {
                                                        ~~~~

data-frame/index.tsx:934:3 - error TS2564: Property 'errorRoot' has no initializer and is not definitely assigned in the constructor.

934   errorRoot: HTMLSpanElement;
      ~~~~~~~~~

data-frame/table-summary.tsx:59:9 - error TS18048: 'firstRow' is possibly 'undefined'.

59     if (firstRow.index === 0 && lastRow.index === nrows - 1) {
           ~~~~~~~~

data-frame/table-summary.tsx:59:33 - error TS18048: 'lastRow' is possibly 'undefined'.

59     if (firstRow.index === 0 && lastRow.index === nrows - 1) {
                                   ~~~~~~~

data-frame/table-summary.tsx:66:7 - error TS18048: 'firstRow' is possibly 'undefined'.

66       firstRow.index + 1,
         ~~~~~~~~

data-frame/table-summary.tsx:67:7 - error TS18048: 'lastRow' is possibly 'undefined'.

67       lastRow.index + 1,
         ~~~~~~~

data-frame/table-summary.tsx:101:15 - error TS2345: Argument of type 'TItem | undefined' is not assignable to parameter of type 'TItem'.
  'TItem' could be instantiated with an arbitrary type which could be unrelated to 'TItem | undefined'.

101       if (map(item, true) >= start) {
                  ~~~~

data-frame/table-summary.tsx:106:15 - error TS2345: Argument of type 'TItem | undefined' is not assignable to parameter of type 'TItem'.
  'TItem' could be instantiated with an arbitrary type which could be unrelated to 'TItem | undefined'.

106       if (map(item, false) <= end) {
                  ~~~~


Found 37 errors in 5 files.

Errors  Files
     3  data-frame/cell.tsx:202
     7  data-frame/data-update.tsx:82
     4  data-frame/filter.tsx:37
    17  data-frame/index.tsx:120

@schloerke schloerke added this to the v1.0.0 milestone Jul 2, 2024
* main:
  feat(data frame): Support `polars` (#1474)
  api(playwright): Code review of complete playwright API (#1501)
  fix: Move `www/shared/py-shiny` to `www/py-shiny` (#1499)
  test(controllers): Refactor column sort and filter methods for Dataframe class (#1496)
  Follow up to #1453: allow user roles when normalizing a dictionary (#1495)
  fix(layout_columns): Fix coercion of scalar row height to list for python <= 3.9 (#1494)
  Add `shiny.ui.Chat` (#1453)
  docs(Theme): Fix example and clarify usage (#1491)
  chore(pyright): Pin pyright version to `1.1.369` to avoid CI failures (#1493)
@schloerke schloerke marked this pull request as ready for review July 9, 2024 07:34
@schloerke schloerke enabled auto-merge July 9, 2024 07:37
@schloerke schloerke added this pull request to the merge queue Jul 9, 2024
@schloerke schloerke removed this pull request from the merge queue due to a manual request Jul 9, 2024
@schloerke schloerke enabled auto-merge July 9, 2024 07:45
@schloerke schloerke added this pull request to the merge queue Jul 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 9, 2024
@schloerke schloerke added this pull request to the merge queue Jul 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 9, 2024
@schloerke schloerke added this pull request to the merge queue Jul 9, 2024
Merged via the queue into main with commit c1423f8 Jul 9, 2024
31 checks passed
@schloerke schloerke deleted the df-ts-updates branch July 9, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant