npm i
npm run build
When having multiple re-exports by using export { default } from './Component
in a barrel file (es6 module) seems to not resolve types correctly.
E.g
// Foo/Foo.tsx
import { FC } from "react";
const Foo: FC<{
name: string;
}> = ({ name }) => <h2>Foo {name}</h2>;
export default Foo;
// Foo/index.ts
export { default } from "./Foo";
// index.ts
export { default as Foo } from "./Foo";
results in a d.ts
file like:
export { default as Foo };
but if instead of using re-export use import and then export works fine.
// Foo/index.ts
import Foo from "./Foo";
export default Foo
import { FC } from 'react';
interface BarProps {
lastName: string;
}
declare const Bar: FC<BarProps>;
interface HelloWorldProps {
name: string;
}
declare const Foo: FC<HelloWorldProps>;
export { Bar, Foo };
export { default as Bar, default as Foo };