Bug Report
π Search Terms
import, elision, elided, default
π Version & Regression Information
- This changed between versions 4.1.5 and 4.2.3
β― Playground Link
Workbench Repro
π» Code
// @showEmit
import MyFunction from "./MyComponent";
MyFunction({msg: "Hello World"}); // Runtime error, MyFunction was not imported
// @filename: MyComponent.ts
interface MyFunction { msg: string; } // adding export here fixes
export const MyFunction = ({ msg }: MyFunction) => console.log(`Got message "${msg}"`); // removing export here fixes
export default MyFunction;
π Actual behavior
The import MyFunction from "./MyComponent"; is elided from the output - causing the MyFunction(x) line to crash.
π Expected behavior
Expected the import not to be elided since it is exporting a value, and the import is used as a value.
Alternatively, an error about this pattern of default export + named export + non-exported type would be helpful. This is a bizarre, accidental, export pattern, and it was an easy fix, but it was a bit tricky to track down. (We found this when switching a large codebase from babel compilation to TS compilation)
Bug Report
π Search Terms
import, elision, elided, default
π Version & Regression Information
β― Playground Link
Workbench Repro
π» Code
π Actual behavior
The
import MyFunction from "./MyComponent";is elided from the output - causing theMyFunction(x)line to crash.π Expected behavior
Expected the import not to be elided since it is exporting a value, and the import is used as a value.
Alternatively, an error about this pattern of default export + named export + non-exported type would be helpful. This is a bizarre, accidental, export pattern, and it was an easy fix, but it was a bit tricky to track down. (We found this when switching a large codebase from babel compilation to TS compilation)