Stack Exchange
VSCode does not suggest auto import when re-exporting a default export in an index file
I'm working on a React app and came to this case.
Input:

The folder structure:
/ProductTypeSelection
  index.tsx
  ProductTypeSelectionView.tsx


ProductTypeSelectionView.tsx:
const ProductTypeSelectionView: React.FunctionComponent<ProductTypeSelectionViewProps> = () => {
 return <div />;
};

export default ProductTypeSelectionView;


index.tsx:
export { default } from './ProductTypeSelectionView'



Desired output
Right now I could import that ProductTypeSelection component like this: import ProductTypeSelection from 'src/ProductTypeSelection' but the VSCode does not suggest auto-import for ProductTypeSelection (just ProductTypeSelectionView).
So my desired output would be able to use that import syntax and get the ProductTypeSelection import suggestion from VSCode at the same time. I wonder if this is achievable, thank you very much.

Tried
This will work as expected but wondering if I could re-write this in 1 line.
import ProductTypeSelection from "./ProductTypeSelectionView";

export default ProductTypeSelection;


You export a default, instead try:
export { default as ProductTypeSelectionView } from './ProductTypeSelectionView'


Using this way the import syntax would be import { ProductTypeSelection } from 'src/ProductTypeSelection'. I wonder if I could keep this syntax import ProductTypeSelection from 'src/ProductTypeSelection'

You can't.. unless you import it normally and export it as default. import Product, export default Product

Thank you, that's what I've tried, I'll update the question.

You can import like this:
export { ProductTypeSelectionView as default } from './ProductTypeSelectionView'

