Open bluelovers opened 3 years ago
Normally I would say this should be considered an error as a native ES module wouldn't normally provide the entire module as the default export. However, that's exactly what NodeJS does for its built-ins like fs
when you use import
in a native module.
It is odd that the following works:
import CID from 'cids'; // passes through __importDefault
import { isCID } from 'cids'; // directly accesses module object
while the combined version doesn't:
import CID, { isCID } from 'cids'; // passes through __importStar, doesn't adjust for default import
@andrewbranch, @weswigham: Any thoughts on this? I'm leaning towards trying to make it work under --esModuleInterop
rather than reporting an error, given that the individual declarations work in this mode.
Bug Report
🔎 Search Terms
class static import
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?module=1#code/JYWwDg9gTgLgBAYQJIBEA0cDedgGdkpwC+cAZlBCHAOQDGwAJrtQNwCwAUJwKYAeksMgFcAdrRjAIIuGACGMABYAVCAkYAKegwBccXDCjARAczgAfRKgCUu-YZOdMnAJDBScdQQB0eApsZWVi5OHM7OUNwwQlDSWl4wEADKBkbG6kGhRJwuEVExcHERYAA2srTc6gD0AHoAOpXAYADaIqQAurj1lRjU1BlZXBx8AvCkouKS0nKKKmoMAEz+OnopJuaWKDYr9saOLm4evqhLgcEu4ZHRsYzxSatpGc4DOZf5hdwlZRU19Y0t7Z1Kt0aH1OM8ONNlKoNL0MpDZoxFrDOEA
💻 Code
🙁 Actual behavior
🙂 Expected behavior