-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
🔨 (grapher) replace some enum types / TAS-709 #4170
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This stack of pull requests is managed by Graphite. Learn more about stacking. |
sophiamersmann
changed the title
refactor types
🔨 (grapher) refactor ChartTypeName and GrapherTabOption / TAS-709
Nov 14, 2024
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 14, 2024 17:35
592a432
to
603bca2
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 14, 2024 17:35
92fd0a6
to
855fe3d
Compare
sophiamersmann
changed the title
🔨 (grapher) refactor ChartTypeName and GrapherTabOption / TAS-709
🔨 (grapher) refactor types around chart&map types and tab options / TAS-709
Nov 14, 2024
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 1366 (4a0376) ❌ Edited: 2024-11-26 09:42:26 UTC |
8 tasks
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 18, 2024 14:03
603bca2
to
7903962
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 18, 2024 14:03
855fe3d
to
8c8f16c
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 18, 2024 15:16
7903962
to
b29748a
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 18, 2024 15:16
8c8f16c
to
c28838b
Compare
sophiamersmann
changed the title
🔨 (grapher) refactor types around chart&map types and tab options / TAS-709
🔨 (grapher) replace some enum types / TAS-709
Nov 18, 2024
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 18, 2024 16:52
c28838b
to
7af0e96
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 19, 2024 05:12
b29748a
to
96b4143
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 19, 2024 05:12
7af0e96
to
39facc2
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 19, 2024 16:59
96b4143
to
1fa7721
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 19, 2024 17:00
39facc2
to
a26c87c
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 19, 2024 18:02
1fa7721
to
e432552
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 19, 2024 18:02
a26c87c
to
231b05d
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 19, 2024 19:27
e432552
to
3098170
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 19, 2024 19:27
231b05d
to
52664e7
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 20, 2024 07:49
3098170
to
4367236
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 20, 2024 07:49
52664e7
to
5ce9aba
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 20, 2024 14:14
4367236
to
74039fd
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 20, 2024 14:14
5ce9aba
to
83a3c4e
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 20, 2024 16:42
83a3c4e
to
f0a16e0
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 21, 2024 12:28
eb80785
to
d5cc21b
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 21, 2024 12:57
14ea177
to
48abe5f
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 21, 2024 12:57
d5cc21b
to
0e247d5
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 22, 2024 08:03
48abe5f
to
72d5a23
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 22, 2024 08:03
0e247d5
to
4d99b3b
Compare
This was referenced Nov 22, 2024
marcelgerber
approved these changes
Nov 25, 2024
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 25, 2024 17:10
72d5a23
to
01171a2
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 25, 2024 17:10
4d99b3b
to
b454cce
Compare
sophiamersmann
force-pushed
the
grapher-types-viz
branch
from
November 26, 2024 09:09
01171a2
to
833685e
Compare
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
2 times, most recently
from
November 26, 2024 09:21
cdc7ecf
to
fa5b967
Compare
sophiamersmann
changed the base branch from
grapher-types-viz
to
graphite-base/4170
November 26, 2024 09:52
sophiamersmann
force-pushed
the
grapher-refactor-types
branch
from
November 26, 2024 09:54
fa5b967
to
1bfc5c5
Compare
This was referenced Nov 26, 2024
This was referenced Dec 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors Grapher types by replacing enums with compile-time-only types.
I introduced
GrapherTabName
in the previous PR, which is either aChartTypeName
or"WorldMap"
or"Table"
. But enums currently can't be extended or merged, which means that I had to copy-paste all chart type names intoGrapherTabName
. As a result, TypeScript doesn't do a good job of type narrowing, forcing me to write (unnecessary) type assertions in many places.This PR refactors
ChartTypeName
and other tab-related types so they don't use enums. However, I still wanted the convenience of a single object to access chart types, for example. To get that, the types are inferred from const objects:I first did it the other way around (first defining the types, then using them for the objects), but it turns out the way it's done now leads to better type narrowing.
Newly introduced types:
GrapherMapType
: only "WorldMap"GrapherChartType
: "LineChart", "ScatterPlot", etc. (without "WorldMap")GrapherChartOrMapType
:GrapherChartType
orGrapherMapType
GrapherTabName
: Internal tab names used in Grapher (a chart type name or "WorldMap" or "Table")GrapherTabOption
: Grapher tab specified in the config that determines the default tab to show ("chart", "map" or "tab")GrapherTabQueryParam
: Valid values for thetab
query parameter in Grapher ("chart", "map", "line", "slope", etc.)