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

Refactor TypeScript definition to CommonJS compatible export #12

Merged
merged 1 commit into from
Apr 5, 2019
Merged

Refactor TypeScript definition to CommonJS compatible export #12

merged 1 commit into from
Apr 5, 2019

Conversation

BendingBender
Copy link
Contributor

Breaking change.

@sindresorhus sindresorhus merged commit 36d8558 into sindresorhus:master Apr 5, 2019
@cmdcolin
Copy link

@BendingBender maybe I'm missing something but in 4.0.0 it appears I'd do a default import but it results in errors from TypeScript

import QuickLRU from 'quick-lru'
error TS1192: Module '"/home/mymodule/node_modules/quick-lru/index"' has no default export.                                                                    

6 import QuickLRU from 'quick-lru'

@sindresorhus
Copy link
Owner

@cmdcolin
Copy link

Ah thanks. I guess even with this I get this error

SyntaxError: `import =` is not supported by @babel/plugin-transform-typescript

If I added allowSyntheticDefaultImports to tsconfig.json and then import QuickLRU from 'quick-lru' then it did seem to work with quick-lru@4.0.0

@BendingBender
Copy link
Contributor Author

I recommend using the esModuleInterop flag, it's the more modern variant of syntheticDefaultImports, it'll work even without Babel.

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.

3 participants