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

Display As Const Enum #1606

Merged
merged 3 commits into from Jun 24, 2020
Merged

Display As Const Enum #1606

merged 3 commits into from Jun 24, 2020

Conversation

JamieB-gu
Copy link
Contributor

@JamieB-gu JamieB-gu commented Jun 17, 2020

What does this change?

Migrates the Display type from a string to a const enum. First part of the work towards migrating DCR to using the types repo. Enabled by #1533.

Before

Display was this type:

type Display = 'standard' | 'immersive' | 'showcase';

After

Display is this type:

declare const enum Display {
    Standard,
    Immersive,
    Showcase,
}

Why?

Will enable DCR and AR to consolidate on the same Format type for articles, which should allow us to share a lot more code. Hopefully will also reduce the bundle size eventually, since in theory const enums produce code that is smaller than strings.

FYI @alexduf @webb04 @frankie297

@github-actions
Copy link

github-actions bot commented Jun 17, 2020

Size Change: +49 B (0%)

Total Size: 544 kB

Filename Size Change
dist/frontend.server.js 204 kB +49 B (0%)
ℹ️ View Unchanged
Filename Size Change
dist/dynamicImport.js 1.89 kB 0 B
dist/dynamicImport.legacy.js 1.94 kB 0 B
dist/ga.js 1.95 kB 0 B
dist/ga.legacy.js 2.44 kB 0 B
dist/GetMatchStats.js 3.44 kB 0 B
dist/GetMatchStats.legacy.js 3.52 kB 0 B
dist/lotame.js 1.08 kB 0 B
dist/lotame.legacy.js 1.07 kB 0 B
dist/MostViewedFooterData.js 5.63 kB 0 B
dist/MostViewedFooterData.legacy.js 5.84 kB 0 B
dist/MostViewedRightWrapper.js 6.25 kB 0 B
dist/MostViewedRightWrapper.legacy.js 6.48 kB 0 B
dist/OnwardsLower.js 10.6 kB 0 B
dist/OnwardsLower.legacy.js 10.9 kB 0 B
dist/OnwardsUpper.js 11.2 kB 0 B
dist/OnwardsUpper.legacy.js 11.4 kB 0 B
dist/ophan.js 5.45 kB 0 B
dist/ophan.legacy.js 5.43 kB 0 B
dist/react.js 98.9 kB 0 B
dist/react.legacy.js 101 kB 0 B
dist/sentry.js 18.7 kB 0 B
dist/sentry.legacy.js 18.3 kB 0 B
dist/shimport.js 3.19 kB 0 B
dist/shimport.legacy.js 3.2 kB 0 B

compressed-size-action

Copy link
Contributor

@gtrufitt gtrufitt left a comment

Choose a reason for hiding this comment

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

I'm in 👍

Copy link
Contributor

@oliverlloyd oliverlloyd left a comment

Choose a reason for hiding this comment

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

Let's do this

@JamieB-gu JamieB-gu merged commit 279ba99 into master Jun 24, 2020
@JamieB-gu JamieB-gu deleted the display-const-enum branch June 24, 2020 11:38
tjmw added a commit that referenced this pull request Jun 24, 2020
This reverts commit 279ba99, reversing
changes made to 5b7297f.
tjmw added a commit that referenced this pull request Jun 24, 2020
Revert "Merge pull request #1606 from guardian/display-const-enum"
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

3 participants