-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Revert import order to fix imported class being not yet defined #2599
Conversation
cc @inferrinizzard and @dvdsgl, who wrote and reviewed #2558. |
By digging a bit deeper, I found a way to avoid the circular dependency issue as a user of this package: always ensure the "root" import { removeNullFromType } from 'quicktype-core/dist/TypeUtils.js'; Changing the import to: import 'quicktype-core'
import { removeNullFromType } from 'quicktype-core/dist/TypeUtils.js'; ensures dependencies are loaded in order. I guess there are two ways to solve this problem: fixing circular dependencies in |
@flovouin thanks for the PR!
^ This would probably end up being a better long term path once I finalise a guide on how to more easily create new custom language and behaviours - what specific utilities are you using that aren't exported yet ? |
@inferrinizzard let's take a look at our automerge settings – this merged itself after failing. |
Thanks!
Here's what I found in my codebase: import { RenderContext, Renderer } from 'quicktype-core/dist/Renderer.js';
import { SourcelikeArray } from 'quicktype-core/dist/Source.js';
import { descriptionTypeAttributeKind, propertyDescriptionsTypeAttributeKind } from 'quicktype-core/dist/attributes/Description.js';
import { AcronymStyleOptions } from 'quicktype-core/dist/support/Acronyms.js';
import { ConvertersOptions } from 'quicktype-core/dist/support/Converters.js';
import { removeNullFromType } from 'quicktype-core/dist/TypeUtils.js'; |
Description
This PR fixes a circular dependency issue following ESlint-related changes in #2558.
Using
quicktype-core
in my own project crashes at runtime because of this issue since version23.0.159
with the following error:There are many ESlint
import/no-cycle
errors being disabled in the codebase. I wouldn't be surprised if other refactored imports were problematic. However fixing this one was enough in my case.I apologise for the lack of reproduction example and addition of tests. However it seems that only "end to end" tests for each language exist. I did run the existing tests and linter, though.
Related Issue
This follows the changes in #2558.
Motivation and Context
I can no longer use
quicktype-core
as a dependency since version23.0.159
.Previous Behaviour / Output
New Behaviour / Output
My project relying on
quicktype-core
passes its test suite.How Has This Been Tested?
I patched the
quicktype-core
distribution in my own project with the change in this PR.Screenshots (if appropriate):
N/A