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

fix: typescript errors in 4.0 #27402

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Mar 5, 2024

SUMMARY

This fixes the a bunch of typescript errors in 4.0.

  1. makeApi.ts (from chore(hail mary): Update package-lock.json via npm-audit-fix #26693)
@superset-ui/core/src/query/api/v1/makeApi.ts:118:38 - error TS2352: Conversion of type 'Payload' to type 'URLSearchParams' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

118         requestConfig.searchParams = payload as URLSearchParams;
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

@superset-ui/core/src/query/api/v1/makeApi.ts:122:37 - error TS2352: Conversion of type 'Payload' to type 'FormData' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

122         requestConfig.postPayload = payload as FormData;
                                        ~~~~~~~~~~~~~~~~~~~
  1. AlteredSliceTagMocks.ts (from chore: Migrate AlteredSliceTag to typescript #27030)
superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts:20:36 - error TS2307: Cannot find module 'packages/superset-ui-chart-controls/src/types' or its corresponding type declarations.

20 import { ControlPanelConfig } from 'packages/superset-ui-chart-controls/src/types';
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1. AlteredSliceTag/index.tsx (from chore: Migrate AlteredSliceTag to typescript #27030)
superset-frontend/src/components/AlteredSliceTag/index.tsx:184:15 - error TS2339: Property 'comparator' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'comparator' does not exist on type 'string'.

184             v.comparator && v.comparator.constructor === Array
                  ~~~~~~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:184:31 - error TS2339: Property 'comparator' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'comparator' does not exist on type 'string'.

184             v.comparator && v.comparator.constructor === Array
                                  ~~~~~~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:185:23 - error TS2339: Property 'comparator' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'comparator' does not exist on type 'string'.

185               ? `[${v.comparator.join(', ')}]`
                          ~~~~~~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:186:19 - error TS2339: Property 'comparator' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'comparator' does not exist on type 'string'.

186               : v.comparator;
                      ~~~~~~~~~~

../../../apache-superset/superset-frontend/src/components/AlteredSliceTag/index.tsx:187:23 - error TS2339: Property 'subject' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'subject' does not exist on type 'string'.

187           return `${v.subject} ${v.operator} ${filterVal}`;
                          ~~~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:187:36 - error TS2339: Property 'operator' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'operator' does not exist on type 'string'.

187           return `${v.subject} ${v.operator} ${filterVal}`;
                                       ~~~~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:201:48 - error TS2339: Property 'label' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'label' does not exist on type 'string'.

201       const formattedValue = value.map(v => v?.label ?? v);
                                                   ~~~~~

superset-frontend/src/components/AlteredSliceTag/index.tsx:208:48 - error TS2339: Property 'label' does not exist on type 'string | number | FilterItemType | Record<string | number, any>'.
  Property 'label' does not exist on type 'string'.

208       const formattedValue = value.map(v => v?.label ?? v);
                                                   ~~~~~
  1. TelemetryPixel/index.tsx
superset-frontend/src/components/TelemetryPixel/index.tsx:50:7 - error TS2322: Type '"no-referrer-when-downgrade"' is not assignable to type '"no-referrer" | "origin" | "unsafe-url" | undefined'.

50       referrerPolicy="no-referrer-when-downgrade"
         ~~~~~~~~~~~~~~

  superset-frontend/node_modules/@types/react/index.d.ts:2046:9
    2046         referrerPolicy?: "no-referrer" | "origin" | "unsafe-url";
                 ~~~~~~~~~~~~~~

TESTING INSTRUCTIONS

npm run type

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 67.34%. Comparing base (721977a) to head (08fb88d).
Report is 2 commits behind head on master.

Files Patch % Lines
...-frontend/src/components/AlteredSliceTag/index.tsx 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27402      +/-   ##
==========================================
- Coverage   67.34%   67.34%   -0.01%     
==========================================
  Files        1909     1909              
  Lines       74592    74600       +8     
  Branches     8320     8323       +3     
==========================================
+ Hits        50235    50236       +1     
- Misses      22305    22312       +7     
  Partials     2052     2052              
Flag Coverage Δ
javascript 57.21% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@john-bodley john-bodley merged commit ce0b70c into apache:master Mar 6, 2024
29 of 30 checks passed
@michael-s-molina michael-s-molina added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label Mar 7, 2024
michael-s-molina pushed a commit that referenced this pull request Mar 7, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
@mistercrunch mistercrunch added 🍒 4.0.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Apr 17, 2024
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels packages size/S v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🍒 4.0.0 🍒 4.0.1 🍒 4.0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants