Closed
Description
Bug Report
🔎 Search Terms
ts1471, Module X cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead.
🕗 Version & Regression Information
with ts 4.5 beta and module set to "node12"
💻 Code
// import only a type from an ES package from a CJS package
import type { AgendaScheduler } from '@hokify/scheduler';
// some other code
🙁 Actual behavior
It's clear to me that we cannot import from an ES package, but is this true also for type only imports? Is it technically really required to load the type definitions (which are only needed for compile time) with a dynamic import? If so, how would that be done?
🙂 Expected behavior
A type only import from an ES package should still work with module node12 mode within a CJS package