question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'

See original GitHub issue

Hey there, it has taken me already 3 weeks I’m trying to fix this and I didn’t found a solution. In my code source, I created a file called deps.ts at my project root and I export denodb module (export { Database } from "https://deno.land/x/denodb@v1.0.12/mod.ts";). When I run my server, I got many errors that I need help. Theses are errors `error: TS1205 [ERROR]: Re-exporting a type when the ‘–isolatedModules’ flag is provided requires using ‘export type’. export { LogLevels, LevelName } from “./levels.ts”; ~~~~~~~~~ at https://deno.land/std@0.63.0/log/mod.ts:13:21

TS1205 [ERROR]: Re-exporting a type when the ‘–isolatedModules’ flag is provided requires using ‘export type’. Deferred,

  at https://deno.land/x/mysql@v2.5.0/deps.ts:3:3

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { Client, ClientConfig } from "./src/client.ts";
               ~~~~~~~~~~~~
  at https://deno.land/x/mysql@v2.5.0/mod.ts:1:18

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { ObjectId, UpdateOptions } from "./ts/types.ts";
                 ~~~~~~~~~~~~~
  at https://raw.githubusercontent.com/eveningkid/deno_mongo/master/mod.ts:5:20

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
ClientOptions as MongoDBClientOptions,
at https://deno.land/x/denodb@v1.0.12/unstable_deps.ts:11:3

Found 5 errors.`

Anyone got the same ? How to fix them ? I use Deno version 1.5.0, typescript 4.0.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

24reactions
boyarzuncommented, Dec 30, 2020

I had the same problem (-isolatedModules…), this is what helped me to understand:

Type-Only Imports and Export https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-exports (…if you’ve hit issues under --isolatedModules, TypeScript’s transpileModule API, or Babel, this feature might be relevant…)

And here is another example of how I used export type

// deps.ts

import {
    Application,
    Router,
    RouterContext
} from 'https://deno.land/x/oak/mod.ts';

export {
    Application,
    Router,
};

export type { RouterContext };
12reactions
stillalivxcommented, Nov 4, 2020

It seems the issue comes from this: https://deno.land/posts/v1.5#stricter-type-checks-in-stable Luckily, you can override this creating a tsconfig.json in you project with this content:

{
  "compilerOptions": {
    "isolatedModules": false
  }
}

Then, execute your code like this:

deno run -c tsconfig.json --allow-net --allow-read --unstable server.ts

Let me know if this works for you! We have to wait for the others deps update their code. This is a temporary fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 ...
Read more >
isolatedmodules' flag is provided requires using 'export type'
The error message tells you everything. Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.ts(1205).
Read more >
Hey, this is a very cool util, thanks for making it ... - Medium
... as default type VSCode shows this error: ```. Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.ts(1205).
Read more >
Cannot be compiled under '--isolatedModules' because it is ...
To solve the error, add an `export {}` line to the file to make it an ES module. ... flag is provided //...
Read more >
Re exporting a type when the isolatedModules flag is provided ...
ERROR TS1205 : Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'. ERROR TS1371: This import is never used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found