satyarohith / sift

Sift is a routing and utility library for Deno Deploy.

Home Page:https://deno.land/x/sift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type conflicts

Schotsl opened this issue · comments

I was trying to use this package on a new project but got a bunch of errors that seemed to come from the package, so I cloned the latest repository and ran the tests.

I got 49 errors about conflicting definitions, I wish I could resolve them myself but I don't understand what is wrong since it seems to work for everyone else.

It should be noted that I'm running Deno 1.9.2 on MacOS.

schotsl@Sjorss-MacBook-Pro sift % deno test --unstable
Check file:///usr/local/var/www/Deno/Phantom/sift/$deno$test.ts
error: TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: CompileError, Global, Instance, LinkError, Memory, Module, RuntimeError, Table, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, ModuleImports, Imports, BufferSource, MessageEvent, ErrorEvent, Worker, PerformanceEntryList, Performance, PerformanceEntry, PerformanceMark, PerformanceMeasure, CustomEvent
interface Account {
~~~~~~~~~
    at asset:///lib.dom.d.ts:25:1

    Conflicts are in this file.
    declare namespace WebAssembly {
    ~~~~~~~
        at asset:///lib.deno.shared_globals.d.ts:16:1

TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: DOMException, Event, EventTarget, EventListenerOrEventListenerObject, ProgressEvent, TextDecoder, TextEncoder, AbortController
interface Account {
~~~~~~~~~
    at asset:///lib.dom.d.ts:25:1

    Conflicts are in this file.
    declare class DOMException extends Error {
    ~~~~~~~
        at asset:///lib.deno.web.d.ts:8:1

TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: ReadableStreamReader, CountQueuingStrategy, ByteLengthQueuingStrategy, FormDataEntryValue, FormData, HeadersInit, Headers, RequestInfo, RequestCache, RequestCredentials, RequestMode, RequestRedirect, ReferrerPolicy, BodyInit, RequestDestination, Request, ResponseType, Response
interface Account {
~~~~~~~~~
    at asset:///lib.dom.d.ts:25:1

    Conflicts are in this file.
    interface DomIterable<K, V> {
    ~~~~~~~~~
        at asset:///lib.deno.fetch.d.ts:8:1

TS2300 [ERROR]: Duplicate identifier 'Blob'.
interface Blob {
          ~~~~
    at asset:///lib.dom.d.ts:2608:11

    'Blob' was also declared here.
    declare class Blob {
                  ~~~~
        at asset:///lib.deno.file.d.ts:14:15

TS2300 [ERROR]: Duplicate identifier 'Blob'.
declare var Blob: {
            ~~~~
    at asset:///lib.dom.d.ts:2617:13

    'Blob' was also declared here.
    declare class Blob {
                  ~~~~
        at asset:///lib.deno.file.d.ts:14:15

TS2300 [ERROR]: Duplicate identifier 'CloseEvent'.
interface CloseEvent extends Event {
          ~~~~~~~~~~
    at asset:///lib.dom.d.ts:3642:11

    'CloseEvent' was also declared here.
    declare class CloseEvent extends Event {
                  ~~~~~~~~~~
        at asset:///lib.deno.websocket.d.ts:14:15

TS2300 [ERROR]: Duplicate identifier 'CloseEvent'.
declare var CloseEvent: {
            ~~~~~~~~~~
    at asset:///lib.dom.d.ts:3657:13

    'CloseEvent' was also declared here.
    declare class CloseEvent extends Event {
                  ~~~~~~~~~~
        at asset:///lib.deno.websocket.d.ts:14:15

TS2300 [ERROR]: Duplicate identifier 'File'.
interface File extends Blob {
          ~~~~
    at asset:///lib.dom.d.ts:5531:11

    'File' was also declared here.
    declare class File extends Blob {
                  ~~~~
        at asset:///lib.deno.file.d.ts:31:15

TS2300 [ERROR]: Duplicate identifier 'File'.
declare var File: {
            ~~~~
    at asset:///lib.dom.d.ts:5536:13

    'File' was also declared here.
    declare class File extends Blob {
                  ~~~~
        at asset:///lib.deno.file.d.ts:31:15

TS2300 [ERROR]: Duplicate identifier 'Location'.
interface Location {
          ~~~~~~~~
    at asset:///lib.dom.d.ts:9794:11

    'Location' was also declared here.
    declare class Location {
                  ~~~~~~~~
        at asset:///lib.deno.window.d.ts:70:15

TS2300 [ERROR]: Duplicate identifier 'Location'.
declare var Location: {
            ~~~~~~~~
    at asset:///lib.dom.d.ts:9868:13

    'Location' was also declared here.
    declare class Location {
                  ~~~~~~~~
        at asset:///lib.deno.window.d.ts:70:15

TS2300 [ERROR]: Duplicate identifier 'Navigator'.
    at asset:///lib.dom.d.ts:10762:11

    'Navigator' was also declared here.
    declare class Navigator {
                  ~~~~~~~~~
        at asset:///lib.deno.window.d.ts:32:15

TS2300 [ERROR]: Duplicate identifier 'Navigator'.
declare var Navigator: {
            ~~~~~~~~~
    at asset:///lib.dom.d.ts:10786:13

    'Navigator' was also declared here.
    declare class Navigator {
                  ~~~~~~~~~
        at asset:///lib.deno.window.d.ts:32:15

TS2430 [ERROR]: Interface 'ReadableStreamDefaultReader<R>' incorrectly extends interface 'ReadableStreamGenericReader'.
  Types of property 'closed' are incompatible.
    Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
      Type 'void' is not assignable to type 'undefined'.
interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.dom.d.ts:12597:11

TS2300 [ERROR]: Duplicate identifier 'URL'.
interface URL {
          ~~~
    at asset:///lib.dom.d.ts:16046:11

    'URL' was also declared here.
    declare class URL {
                  ~~~
        at asset:///lib.deno.url.d.ts:156:15

TS2300 [ERROR]: Duplicate identifier 'URL'.
declare var URL: {
            ~~~
    at asset:///lib.dom.d.ts:16063:13

    'URL' was also declared here.
    declare class URL {
                  ~~~
        at asset:///lib.deno.url.d.ts:156:15

TS2300 [ERROR]: Duplicate identifier 'URLSearchParams'.
interface URLSearchParams {
          ~~~~~~~~~~~~~~~
    at asset:///lib.dom.d.ts:16073:11

    'URLSearchParams' was also declared here.
    declare class URLSearchParams {
                  ~~~~~~~~~~~~~~~
        at asset:///lib.deno.url.d.ts:8:15

TS2300 [ERROR]: Duplicate identifier 'URLSearchParams'.
declare var URLSearchParams: {
            ~~~~~~~~~~~~~~~
    at asset:///lib.dom.d.ts:16106:13

    'URLSearchParams' was also declared here.
    declare class URLSearchParams {
                  ~~~~~~~~~~~~~~~
        at asset:///lib.deno.url.d.ts:8:15

TS2300 [ERROR]: Duplicate identifier 'WebSocket'.
interface WebSocket extends EventTarget {
          ~~~~~~~~~
    at asset:///lib.dom.d.ts:18365:11

    'WebSocket' was also declared here.
    declare class WebSocket extends EventTarget {
                  ~~~~~~~~~
        at asset:///lib.deno.websocket.d.ts:38:15

TS2300 [ERROR]: Duplicate identifier 'WebSocket'.
declare var WebSocket: {
            ~~~~~~~~~
    at asset:///lib.dom.d.ts:18416:13

    'WebSocket' was also declared here.
    declare class WebSocket extends EventTarget {
                  ~~~~~~~~~
        at asset:///lib.deno.websocket.d.ts:38:15

TS2300 [ERROR]: Duplicate identifier 'Window'.
    at asset:///lib.dom.d.ts:18547:11

    'Window' was also declared here.
    declare class Window extends EventTarget {
                  ~~~~~~
        at asset:///lib.deno.window.d.ts:9:15

TS2300 [ERROR]: Duplicate identifier 'Window'.
declare var Window: {
            ~~~~~~
    at asset:///lib.dom.d.ts:18675:13

    'Window' was also declared here.
    declare class Window extends EventTarget {
                  ~~~~~~
        at asset:///lib.deno.window.d.ts:9:15

TS2300 [ERROR]: Duplicate identifier 'BlobPart'.
type BlobPart = BufferSource | Blob | string;
     ~~~~~~~~
    at asset:///lib.dom.d.ts:20031:6

    'BlobPart' was also declared here.
    type BlobPart = BufferSource | Blob | string;
         ~~~~~~~~
        at asset:///lib.deno.file.d.ts:6:6

TS2300 [ERROR]: Duplicate identifier 'BinaryType'.
type BinaryType = "arraybuffer" | "blob";
     ~~~~~~~~~~
    at asset:///lib.dom.d.ts:20100:6

    'BinaryType' was also declared here.
    type BinaryType = "arraybuffer" | "blob";
         ~~~~~~~~~~
        at asset:///lib.deno.websocket.d.ts:112:6

TS2300 [ERROR]: Duplicate identifier 'Navigator'.
interface Navigator {
          ~~~~~~~~~
    at asset:///lib.dom.iterable.d.ts:167:11

    'Navigator' was also declared here.
    declare class Navigator {
                  ~~~~~~~~~
        at asset:///lib.deno.window.d.ts:32:15

TS2300 [ERROR]: Duplicate identifier 'URLSearchParams'.
interface URLSearchParams {
          ~~~~~~~~~~~~~~~
    at asset:///lib.dom.iterable.d.ts:266:11

    'URLSearchParams' was also declared here.
    declare class URLSearchParams {
                  ~~~~~~~~~~~~~~~
        at asset:///lib.deno.url.d.ts:8:15

TS2300 [ERROR]: Duplicate identifier 'Window'.
declare class Window extends EventTarget {
              ~~~~~~
    at asset:///lib.deno.window.d.ts:9:15

    'Window' was also declared here.
        at asset:///lib.dom.d.ts:18547:11    and here.
    declare var Window: {
                ~~~~~~
        at asset:///lib.dom.d.ts:18675:13

TS2300 [ERROR]: Duplicate identifier 'Navigator'.
declare class Navigator {
              ~~~~~~~~~
    at asset:///lib.deno.window.d.ts:32:15

    'Navigator' was also declared here.
        at asset:///lib.dom.d.ts:10762:11    and here.
    declare var Navigator: {
                ~~~~~~~~~
        at asset:///lib.dom.d.ts:10786:13    and here.
    interface Navigator {
              ~~~~~~~~~
        at asset:///lib.dom.iterable.d.ts:167:11

TS2300 [ERROR]: Duplicate identifier 'Location'.
declare class Location {
              ~~~~~~~~
    at asset:///lib.deno.window.d.ts:70:15

    'Location' was also declared here.
    interface Location {
              ~~~~~~~~
        at asset:///lib.dom.d.ts:9794:11    and here.
    declare var Location: {
                ~~~~~~~~
        at asset:///lib.dom.d.ts:9868:13

TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: CompileError, Global, Instance, LinkError, Memory, Module, RuntimeError, Table, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, ModuleImports, Imports, BufferSource, MessageEvent, ErrorEvent, Worker, PerformanceEntryList, Performance, PerformanceEntry, PerformanceMark, PerformanceMeasure, CustomEvent
declare namespace WebAssembly {
~~~~~~~
    at asset:///lib.deno.shared_globals.d.ts:16:1

    Conflicts are in this file.
    interface Account {
    ~~~~~~~~~
        at asset:///lib.dom.d.ts:25:1

TS2375 [ERROR]: Duplicate number index signature.
  [index: number]: string;
  ~~~~~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.deno.shared_globals.d.ts:367:3

TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: DOMException, Event, EventTarget, EventListenerOrEventListenerObject, ProgressEvent, TextDecoder, TextEncoder, AbortController
declare class DOMException extends Error {
~~~~~~~
    at asset:///lib.deno.web.d.ts:8:1

    Conflicts are in this file.
    interface Account {
    ~~~~~~~~~
        at asset:///lib.dom.d.ts:25:1

TS2300 [ERROR]: Duplicate identifier 'URLSearchParams'.
declare class URLSearchParams {
              ~~~~~~~~~~~~~~~
    at asset:///lib.deno.url.d.ts:8:15

    'URLSearchParams' was also declared here.
    interface URLSearchParams {
              ~~~~~~~~~~~~~~~
        at asset:///lib.dom.d.ts:16073:11    and here.
    declare var URLSearchParams: {
                ~~~~~~~~~~~~~~~
        at asset:///lib.dom.d.ts:16106:13    and here.
    interface URLSearchParams {
              ~~~~~~~~~~~~~~~
        at asset:///lib.dom.iterable.d.ts:266:11

TS2300 [ERROR]: Duplicate identifier 'URL'.
declare class URL {
              ~~~
    at asset:///lib.deno.url.d.ts:156:15

    'URL' was also declared here.
    interface URL {
              ~~~
        at asset:///lib.dom.d.ts:16046:11    and here.
    declare var URL: {
                ~~~
        at asset:///lib.dom.d.ts:16063:13

TS6200 [ERROR]: Definitions of the following identifiers conflict with those in another file: ReadableStreamReader, CountQueuingStrategy, ByteLengthQueuingStrategy, FormDataEntryValue, FormData, HeadersInit, Headers, RequestInfo, RequestCache, RequestCredentials, RequestMode, RequestRedirect, ReferrerPolicy, BodyInit, RequestDestination, Request, ResponseType, Response
interface DomIterable<K, V> {
~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:8:1

    Conflicts are in this file.
    interface Account {
    ~~~~~~~~~
        at asset:///lib.dom.d.ts:25:1

TS2403 [ERROR]: Subsequent variable declarations must have the same type.  Variable 'ReadableStreamDefaultReader' must be of type '{ new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>; prototype: ReadableStreamDefaultReader<any>; }', but here has type '{ new <R>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>; prototype: ReadableStreamDefaultReader<any>; }'.
declare var ReadableStreamDefaultReader: {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:40:13

    'ReadableStreamDefaultReader' was also declared here.
    declare var ReadableStreamDefaultReader: {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at asset:///lib.dom.d.ts:12602:13

TS2314 [ERROR]: Generic type 'ReadableStreamReader' requires 1 type argument(s).
  prototype: ReadableStreamReader;
             ~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:52:14

TS2314 [ERROR]: Generic type 'ReadableStreamReader' requires 1 type argument(s).
  new (): ReadableStreamReader;
          ~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:53:11

TS2403 [ERROR]: Subsequent variable declarations must have the same type.  Variable 'ReadableStream' must be of type '{ new <R = any>(underlyingSource?: UnderlyingSource<R> | undefined, strategy?: QueuingStrategy<R> | undefined): ReadableStream<R>; prototype: ReadableStream<...>; }', but here has type '{ new (underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number | undefined; size?: undefined; } | undefined): ReadableStream<Uint8Array>; new <R = any>(underlyingSource?: UnderlyingSource<...> | undefined, strategy?: QueuingStrategy<...> | undefined): ReadableStream<...>; prototype: ReadableStrea...'.
declare var ReadableStream: {
            ~~~~~~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:174:13

    'ReadableStream' was also declared here.
    declare var ReadableStream: {
                ~~~~~~~~~~~~~~
        at asset:///lib.dom.d.ts:12580:13

TS2717 [ERROR]: Subsequent property declarations must have the same type.  Property 'closed' must be of type 'Promise<undefined>', but here has type 'Promise<void>'.
  readonly closed: Promise<void>;
           ~~~~~~
    at asset:///lib.deno.fetch.d.ts:236:12

    'closed' was also declared here.
        readonly closed: Promise<undefined>;
                 ~~~~~~
        at asset:///lib.dom.d.ts:18811:14

TS2717 [ERROR]: Subsequent property declarations must have the same type.  Property 'ready' must be of type 'Promise<undefined>', but here has type 'Promise<void>'.
  readonly ready: Promise<void>;
           ~~~~~
    at asset:///lib.deno.fetch.d.ts:238:12

    'ready' was also declared here.
        readonly ready: Promise<undefined>;
                 ~~~~~
        at asset:///lib.dom.d.ts:18813:14

TS2403 [ERROR]: Subsequent variable declarations must have the same type.  Variable 'WritableStreamDefaultWriter' must be of type '{ new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>; prototype: WritableStreamDefaultWriter<any>; }', but here has type '{ new (): WritableStreamDefaultWriter<any>; prototype: WritableStreamDefaultWriter<any>; }'.
declare var WritableStreamDefaultWriter: {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at asset:///lib.deno.fetch.d.ts:245:13

    'WritableStreamDefaultWriter' was also declared here.
    declare var WritableStreamDefaultWriter: {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at asset:///lib.dom.d.ts:18820:13

TS2300 [ERROR]: Duplicate identifier 'BlobPart'.
type BlobPart = BufferSource | Blob | string;
     ~~~~~~~~
    at asset:///lib.deno.file.d.ts:6:6

    'BlobPart' was also declared here.
    type BlobPart = BufferSource | Blob | string;
         ~~~~~~~~
        at asset:///lib.dom.d.ts:20031:6

TS2300 [ERROR]: Duplicate identifier 'Blob'.
declare class Blob {
              ~~~~
    at asset:///lib.deno.file.d.ts:14:15

    'Blob' was also declared here.
    interface Blob {
              ~~~~
        at asset:///lib.dom.d.ts:2608:11    and here.
    declare var Blob: {
                ~~~~
        at asset:///lib.dom.d.ts:2617:13

TS2300 [ERROR]: Duplicate identifier 'File'.
declare class File extends Blob {
              ~~~~
    at asset:///lib.deno.file.d.ts:31:15

    'File' was also declared here.
    interface File extends Blob {
              ~~~~
        at asset:///lib.dom.d.ts:5531:11    and here.
    declare var File: {
                ~~~~
        at asset:///lib.dom.d.ts:5536:13

TS2300 [ERROR]: Duplicate identifier 'CloseEvent'.
declare class CloseEvent extends Event {
              ~~~~~~~~~~
    at asset:///lib.deno.websocket.d.ts:14:15

    'CloseEvent' was also declared here.
    interface CloseEvent extends Event {
              ~~~~~~~~~~
        at asset:///lib.dom.d.ts:3642:11    and here.
    declare var CloseEvent: {
                ~~~~~~~~~~
        at asset:///lib.dom.d.ts:3657:13

TS2300 [ERROR]: Duplicate identifier 'WebSocket'.
declare class WebSocket extends EventTarget {
              ~~~~~~~~~
    at asset:///lib.deno.websocket.d.ts:38:15

    'WebSocket' was also declared here.
    interface WebSocket extends EventTarget {
              ~~~~~~~~~
        at asset:///lib.dom.d.ts:18365:11    and here.
    declare var WebSocket: {
                ~~~~~~~~~
        at asset:///lib.dom.d.ts:18416:13

TS2300 [ERROR]: Duplicate identifier 'BinaryType'.
type BinaryType = "arraybuffer" | "blob";
     ~~~~~~~~~~
    at asset:///lib.deno.websocket.d.ts:112:6

    'BinaryType' was also declared here.
    type BinaryType = "arraybuffer" | "blob";
         ~~~~~~~~~~
        at asset:///lib.dom.d.ts:20100:6

TS2717 [ERROR]: Subsequent property declarations must have the same type.  Property 'subtle' must be of type 'SubtleCrypto', but here has type 'null'.
  readonly subtle: null;
           ~~~~~~
    at asset:///lib.deno.crypto.d.ts:9:12

    'subtle' was also declared here.
        readonly subtle: SubtleCrypto;
                 ~~~~~~
        at asset:///lib.dom.d.ts:3749:14

Found 49 errors.

@Schotsl Thanks for opening the issue. I updated the readme. The tests will be fixed soon after a bug in Deno native HTTP server is fixed.

The updated README.md solved it, thank you! :)