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

Circular references in typing #253

Closed
seriema opened this issue Nov 8, 2020 · 4 comments
Closed

Circular references in typing #253

seriema opened this issue Nov 8, 2020 · 4 comments

Comments

@seriema
Copy link

seriema commented Nov 8, 2020

We use dts-bundle-generator and running dts-bundle-generator --out-file dist/bundle.d.ts src/main.ts results in errors around circular dependencies in the types:

../../node_modules/cnbuilder/dist/types.d.ts(1,21): error TS2456: Type alias 'ClassValue' circularly references itself.
19:07:34
../../node_modules/cnbuilder/dist/types.d.ts(2,21): error TS2456: Type alias 'ClassListArray' circularly references itself.
@xobotyi
Copy link
Owner

xobotyi commented Nov 8, 2020

That one is unfixable.
Since cnb supports any level of nesting (array-wise) there is no other way to type it without circular types.

@xobotyi
Copy link
Owner

xobotyi commented Nov 8, 2020

Weel it is actually fixable in case i'll change the behaviour and make only one level of array nesting possible.
Because i've made the library to be a drop-in replacement of classnames, which supports any level of array nesting, i've left that behavior, but if judge sanity-wise - there is no sence: i've never had nested array-classlist for last 3 years im using classnames building libraries.

@seriema
Copy link
Author

seriema commented Nov 8, 2020 via email

@seriema
Copy link
Author

seriema commented Nov 14, 2020

Silly me, I should have checked dts-bundle-generator first. It was outdated and using a lower version of TypeScript (3.6.2, that didn't have circular reference support). Upgrading fixed the issue.

@seriema seriema closed this as completed Nov 14, 2020
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

No branches or pull requests

2 participants