`import type` declarations should not appear in the JS output and should not have any effect on the JS output. As of 4.0 adding `import type` to a file causes `export {};` to be added to the output. This worked in 3.8 This breaks components that use ES modules syntax (because the rest of project also uses it) but will not be loaded as modules. Examples include service workers, web workers, shared workers and custom elements loaded as side effects. This is a breaking change with no workaround possible in TS. External workarounds are possible. The general case has already been raised as #41513, this issue is specifically for the subset where the files _only_ contain `import type` declarations and no plain `import` statements. The documentation for [`import type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) states: > `import type` only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there’s no remnant of it at runtime. This was the case in 3.8, it is not the case with 4.0 **TypeScript Version:** 4.0.5 **Search Terms:** `import type`, `export {}` **Code** Using `import type` in a file so that TS can check types: ```ts import type { InterfaceType } from './MyLibrary'; const test: InterfaceType = {}; ``` Note that this file is not a module and will not be loaded as a module. **Expected behavior:** JS output should not include any reference to the `import type` declaration: ```js const test = {}; ``` **Actual behavior:** JS output includes `export {};` to force the output to be a module: ```js const test = {}; export {}; ``` **Related Issues:** - Bug in Webpack this change was introduced to fix: https://github.com/webpack/webpack/issues/10889 - Not all TS users also use Webpack, is it a pre-requisite now? - Design meeting where problems this change introduces were dismissed: https://github.com/microsoft/TypeScript/issues/38713 - Apparently _"They will have a point"_, though it's not clear whether anything followed from that. - Change to always `export {};` where this exact issue with `import type` was already identified: https://github.com/microsoft/TypeScript/issues/38696#issuecomment-699558340 - Bug raised for general case: https://github.com/microsoft/TypeScript/issues/41513