馃悰 Fix import cycles - #174
Merged
Merged
Conversation
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.
馃摑 Description of the PR
Removes the circular imports present in the
nestjssources. Three cycles existed: between the error DTOs and the OpenAPI decorators, within the pagination decorators, and between the healthcheck barrel and its module.Because the project compiles with
verbatimModuleSyntax, animport { X }statement is emitted verbatim into the JavaScript output even whenXis only ever used in a type position. Several OpenAPI and pagination decorators imported classes purely for typing, which turned type-only dependencies into real runtime edges. These are nowimport typestatements, which are fully erased at compile time. Modules that reached for a sibling barrel re-exporting them now import the specific file they need instead.The error DTO cycle was the one that could actually fail at runtime:
try-map.tsbuilds its error cases at module load time, so entering the cycle from the wrong side left a DTO class in its temporal dead zone. The healthcheck cycle was latent rather than live, as the shared constant is only read inside a static factory method; it would have become a genuine failure as soon as anything used it during module evaluation. To break it,HEALTHCHECK_ENDPOINTmoved out of the healthcheck barrel into its own module, and the barrel re-exports it.The public API is unchanged: every symbol is still exported from the same package entry points as before.
馃搵 Check list
馃И Unit tests have been written.馃摑 Documentation has been updated.