You just need to use this syntax when re-exporting types:
export type { timeSlots } from './pages/index.interface';
// ^^^^
// Use the "type" keyword
Or, if using a version of TypeScript >= 4.5
, you can use the type
modifier before each exported type identifier instead:
export { type timeSlots } from './pages/index.interface';
// ^^^^
// Use the "type" keyword
The second approach allows you to mix type and value identifiers in a single export
statement:
export { greet, type GreetOptions } from './greeting-module';
Where greeting-module.ts
might look like this:
export type GreetOptions = {
name: string;
};
export function greet(options: GreetOptions): void {
console.log(`Hello ${options.name}!`);
}