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

Question about YN 4.0 Breaking change #27

Closed
eitah opened this issue Feb 4, 2020 · 1 comment
Closed

Question about YN 4.0 Breaking change #27

eitah opened this issue Feb 4, 2020 · 1 comment

Comments

@eitah
Copy link

eitah commented Feb 4, 2020

I had a question about why this decision was chosen:
Only use a CommonJS export for the TypeScript definition You need to change import yn from 'yn'; to import yn = require('yn');
Is the best practice now to disallow ECMASCRIPT imports as you have done in version 4 by not exposing import?

And what causes the import yn = syntax to work. Shouldn't it be const yn = if it's true common-js?

@sindresorhus
Copy link
Owner

I'm not disallowing use in ESM. I'm just correcting a mistake. This module is CommonJS and that should be defined in the TypeScript file too.

See sindresorhus/memoize#31 for context.


And what causes the import yn = syntax to work. Shouldn't it be const yn = if it's true common-js?

import yn = require(…) is a TypeScript only syntax.

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