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

esModuleInterop does not implicitly enable allowSyntheticDefaultImports #26193

Closed
ffxsam opened this issue Aug 3, 2018 · 6 comments
Closed
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@ffxsam
Copy link

ffxsam commented Aug 3, 2018

TypeScript Version: 2.9.x and 3.x

Search Terms:
esmoduleinterop
esmoduleinterop allowsyntheticdefaultimports

Expected behavior:
Enabling esModuleInterop should also implicitly enable allowSyntheticDefaultImports, according to https://www.typescriptlang.org/docs/handbook/compiler-options.html

Actual behavior:
This is not the case, as per this issue: vuejs/vue-cli#2062

@DanielRosenwasser
Copy link
Member

What are your thoughts here @weswigham?

@weswigham
Copy link
Member

It does but only if targeting a module < es6, since that's all we control the emit behavior for. It's a weak justification, though - I can see changing it.

@ffxsam
Copy link
Author

ffxsam commented Aug 3, 2018

Hey @DanielRosenwasser, I saw your other comment about the docs being wrong. So this is a toss-up. Whatever you guys think makes the most sense. I only stumbled upon this because the Vue CLI tool was only setting esModuleInterop, expecting the synthetic import option to also be enabled (which it wasn't). And this was causing webpack issues.

@kellycampbell
Copy link

The case of this I just ran into with both 3.0.1 and 2.9.2 has "target": "es5" and "esModuleInterop": "true" in the tsconfig. The import that was failing until I also enabled allowSyntheticDefaultImports was:

import React from 'react';

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Aug 6, 2018
@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Committed The team has roadmapped this issue and removed In Discussion Not yet reached consensus labels Aug 23, 2018
@RyanCavanaugh
Copy link
Member

Would appreciate a PR for this!

@NMinhNguyen
Copy link
Contributor

NMinhNguyen commented Sep 4, 2018

@RyanCavanaugh Per the contributing guide,

If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

I've submitted PR #26866.

@DanielRosenwasser I have submitted microsoft/TypeScript-Handbook#816 reverting microsoft/TypeScript-Handbook@8e974c8 for when/if my PR lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants