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

Use import = require syntax to resolve "Circular definition" error with esModuleInterop #86

Closed
wants to merge 1 commit into from

Conversation

jekh
Copy link

@jekh jekh commented Feb 15, 2018

When using typescript 2.7 with --esModuleInterop, typescript gives this error when using ts-mockito:

node_modules/ts-mockito/lib/ts-mockito.d.ts(39,8): error TS2303: Circular definition of import alias 'mockito'.

Switching to the typescript-specific import = require-style import fixes this issue and is compatible with the non-esModuleInterop setting as well. It's the same solution that was used to address another interop-related issue in microsoft/TypeScript#21535

Is there a reason ts-mockito.ts needs to self-import? That seems like it might have other unintended consequences.

@bendykowski
Copy link
Collaborator

Hi @jekh, thank you for this PR. What do you think about the solution proposed by @jjordan-dff in #69? I think that one would be much cleaner for what guys wanted to achieve here. A default export was introduced to satisfy ember-browserify library.

@jekh
Copy link
Author

jekh commented Feb 16, 2018

#69 would be great, and personally I think it's cleaner than the self-import. I'll close this PR in favor of that one. Thanks for taking a look!

@jekh jekh closed this Feb 16, 2018
@jekh jekh deleted the change-self-import branch February 16, 2018 09:37
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.

2 participants