Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

chore(chart): remove faux @superset-ui/core TS declaration #121

Merged
merged 7 commits into from
Mar 22, 2019

Conversation

williaster
Copy link
Contributor

@williaster williaster commented Mar 20, 2019

🏠 Internal

This PR removes the faux @superset-ui/core TS declaration in @superset-ui/chart (introduced before core was re-written in TS). All of the changes are to clean up resulting TS errors from that removal. Some notes on specifics that were done:

  • Refined and consolidated some types that were duplicated across files like ChartType, (Pre/Post)TransformProps, etc.. Turns out the duplication wasn't always entirely consistent though at surface level it might not be obvious.
  • Added the needed generics to all of the chart plugin registrys
  • Updated the logic for supporting Value | { default: Value } generally across loaders. This is now confined to ChartPlugin in order to simplify types elsewhere, while still supporting dynamic loading of ES modules: () => import('foo').default

(EDIT: The following was refactored so as not to be a breaking change)

💔 Breaking Changes

  • Removed support for { default: Type } in Registry loaders, which was previously allowed due to a Chart type using module.exports instead of export defaulting. This simplifies typing when using these components which I think is a win 🏆. I think worst case if this is problematic in incubator Superset we could update () => import('./module.xxx') calls to () => import('./module.xxx').default

TODO

  • 💯 % coverage
  • fix .default issue .. may not be a breaking change

@kristw @conglei @xtinec

@williaster williaster requested a review from a team as a code owner March 20, 2019 06:06
@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #121 into master will decrease coverage by 0.2%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #121      +/-   ##
==========================================
- Coverage     100%   99.79%   -0.21%     
==========================================
  Files          76       76              
  Lines         958      959       +1     
  Branches      229      230       +1     
==========================================
- Hits          958      957       -1     
- Misses          0        1       +1     
- Partials        0        1       +1
Impacted Files Coverage Δ
.../src/registries/ChartComponentRegistrySingleton.ts 100% <ø> (ø) ⬆️
...ages/superset-ui-chart/src/models/ChartMetadata.ts 100% <ø> (ø) ⬆️
...t/src/registries/ChartMetadataRegistrySingleton.ts 100% <ø> (ø) ⬆️
...registries/ChartTransformPropsRegistrySingleton.ts 100% <ø> (ø) ⬆️
...src/registries/ChartBuildQueryRegistrySingleton.ts 100% <ø> (ø) ⬆️
...ckages/superset-ui-chart/src/models/ChartPlugin.ts 90.47% <0%> (-9.53%) ⬇️
packages/superset-ui-core/src/models/Registry.ts 100% <100%> (ø) ⬆️
...kages/superset-ui-chart/src/clients/ChartClient.ts 100% <100%> (ø) ⬆️
...es/superset-ui-chart/src/components/SuperChart.tsx 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ade9dbe...dd0816a. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #121 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #121   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          76     76           
  Lines         958    965    +7     
  Branches      229    232    +3     
=====================================
+ Hits          958    965    +7
Impacted Files Coverage Δ
.../src/registries/ChartComponentRegistrySingleton.ts 100% <ø> (ø) ⬆️
...ages/superset-ui-chart/src/models/ChartMetadata.ts 100% <ø> (ø) ⬆️
...t/src/registries/ChartMetadataRegistrySingleton.ts 100% <ø> (ø) ⬆️
...registries/ChartTransformPropsRegistrySingleton.ts 100% <ø> (ø) ⬆️
...src/registries/ChartBuildQueryRegistrySingleton.ts 100% <ø> (ø) ⬆️
...ckages/superset-ui-chart/src/models/ChartPlugin.ts 100% <100%> (ø) ⬆️
packages/superset-ui-core/src/models/Registry.ts 100% <100%> (ø) ⬆️
...kages/superset-ui-chart/src/clients/ChartClient.ts 100% <100%> (ø) ⬆️
...es/superset-ui-chart/src/components/SuperChart.tsx 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccf9965...fc77263. Read the comment docs.

@williaster
Copy link
Contributor Author

all right, made this compatible with the default syntax, should be good to go 🚀

@williaster williaster force-pushed the chris--fix-core-TS-declaration-in-charts branch from 2d990e5 to fc77263 Compare March 22, 2019 18:04
Copy link
Contributor

@kristw kristw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@williaster williaster merged commit e4b7adb into master Mar 22, 2019
@delete-merged-branch delete-merged-branch bot deleted the chris--fix-core-TS-declaration-in-charts branch March 22, 2019 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants