9

I recently update deno from v1.3.0 to v1.4.0. Before updating, my code doesn't have any problem, but after that i have this error:

error: TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
  LevelName,
  ~~~~~~~~~
    at https://deno.land/x/branch@0.0.2/deps.ts:8:3

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { LogConfig, setup, prefix } from "./branch.ts";
         ~~~~~~~~~
    at https://deno.land/x/branch@0.0.2/mod.ts:3:10

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { WatcherConfig } from "./watcher.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/config.ts:14:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { RunnerConfig } from "./runner.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/config.ts:15:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Args } from "./args.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/config.ts:18:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Template } from "./templates.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/config.ts:19:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Denon, DenonEvent } from "../denon.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/daemon.ts:5:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { CompleteDenonConfig } from "./config.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/daemon.ts:6:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { ScriptOptions } from "./scripts.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/denon@2.3.3/src/daemon.ts:7:1

I found a page that fix this problem, but this error looks like it's coming from third party library. I also use Denon to run the script. Here is my imported package:

import { Application } from "https://deno.land/x/oak/mod.ts";
import { oakCors } from "https://deno.land/x/cors/mod.ts";
import { Router } from "https://deno.land/x/oak/mod.ts";
import { RouterContext } from "https://deno.land/x/oak/mod.ts";
import * as bcrypt from "https://deno.land/x/bcrypt/mod.ts";
import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
import { MongoClient } from "https://deno.land/x/mongo@v0.11.1/mod.ts";

And this is my denon.json:

{
  "$schema": "https://deno.land/x/denon/schema.json",
  "scripts": {
    "start": {
      "cmd": "deno run --unstable server.ts",
      "allow": [
        "net",
        "write",
        "read",
        "plugin"
      ]
    }
  }
}

Is there a way to fix this? or a way to downgrade Deno?

BookShell527
  • 176
  • 2
  • 8

6 Answers6

7

Setting tsconfig like this will solve the problem

{
  "compilerOptions": {
    "importsNotUsedAsValues": "remove",
    "isolatedModules": false,
  }
}
GGICE
  • 71
  • 1
6

There was an unstable feature added in Deno v1.4.0. https://github.com/denoland/deno/pull/7413. A similar issue was here https://github.com/Jozty/Fae/issues/32 This will be fixed by the library writers or you can raise PR with a fix. A temporary fix is to downgrade Deno to v1.3.0

3

Or you could just do import type instead of just import where necessary.

Jonathan
  • 3,893
  • 5
  • 46
  • 77
2

As you asked, if you want to downgrade, you can do as

With Shell:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.3.0

With Scoop:

scoop install deno@1.3.0

Or you can check for a different environment here.

DevLoverUmar
  • 11,809
  • 11
  • 68
  • 98
2

The DevLoverUmar's solution to downgrade did'nt work for me, but this one did :

deno upgrade --version 1.3.0

Jack_Modesta
  • 101
  • 7
1

The TS1205 "Re-exporting a type..." check is now included in Deno 1.5 by default.

This section of the release notes has more instructions on how to update affected code or turn it off.

grunet
  • 311
  • 2
  • 9