Reputation: 4260
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)
Upvotes: 12
Views: 6317
Reputation: 868
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!
Upvotes: 13
Reputation: 49
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.
Upvotes: 4