I want to re-export all types in a module. Is there a way to achieve this?
I did try:
export type * from 'react-router-dom';
But it doesn't work:
Only named exports may use 'export type'. ts(1383)
Typescript 5.0 now has support for this:
export type * from "external-module"
//OR
export type * as ns from "external-module".
Update typescript and you’ll be able to!
First, you need to import the type as Types then export it like this way.
// your-module
import type * as Types from "external-module";
export { Types };
// Usage by the end user
import { Types } from "your-module";
let a:Types.Class;
hope it's helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With