Re-exporting a type when the ‘–isolatedModules’ flag is provided requires using ‘export type’.ts

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}!`);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)