ref(types): define IntervalPeriod without importing charts/utils#116853
Open
JoshuaKGoldberg wants to merge 8 commits into
Open
ref(types): define IntervalPeriod without importing charts/utils#116853JoshuaKGoldberg wants to merge 8 commits into
JoshuaKGoldberg wants to merge 8 commits into
Conversation
`overlay` and `useHoverOverlay` were pulled into the frontend type-import strongly-connected component (SCC) solely by value-imports from the `sentry/constants` and `sentry/utils` god-barrels: - `NODE_ENV` now comes from the `sentry/constants/env` leaf - `defined` is extracted to a `sentry/utils/defined` leaf (the `sentry/utils` barrel re-exports it, so existing consumers are untouched) With those two modules out of the cycle, `core/tooltip` — one of the most widely-imported core components — and its dependents leave the SCC too. Largest SCC drops 1867 -> 1770. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-tooltip # Conflicts: # static/app/utils.tsx
getInterval returns string, so IntervalPeriod is equivalent to a plain string. Importing it pulled the foundational types/core module into the frontend import cycle; defining the alias directly removes that edge.
Rather than hardcoding `IntervalPeriod = string` in the foundational `types/core` module, relocate the type to `organizationStats/types`, where all four of its consumers live. It is purely an organizationStats usage-stats concept and was never used elsewhere. Living there, it can keep `ReturnType<typeof getInterval>` cycle-free, since organizationStats already depends on `charts/utils`. Core sheds the type entirely instead of just swapping the import for a hardcoded `string`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l-period # Conflicts: # static/app/types/core.tsx # static/app/views/organizationStats/usageChart/index.tsx
This file contains hidden or 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
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.
Why
Part of the series shrinking the frontend's largest type-import strongly-connected component (SCC). Identified via a greedy independent-cut analysis of the import graph.
types/coreis a foundational types module (imported by ~155 other SCC members), but it was dragged into the cycle by a single edge: it importedgetIntervalfromsentry/components/charts/utilsonly to writeexport type IntervalPeriod = ReturnType<typeof getInterval>.What
getInterval's declared return type isstring(its fidelity ladder'sgetInterval(minutes: number): string), soIntervalPeriodis already exactlystring. Define it directly and drop the import.Impact
Largest import SCC: 1697 → 1680 (−17).