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

Getting errors when trying to run sift with deployctl

twilson63 opened this issue Β· comments

πŸ‘‹πŸ» - Hi,

Thank you for the wonderful library, I am having some trouble running it using deployctl. It seems to run fine on the deno deploy cloud. But when I try to run local, it generates a lot of conflicting type defs

Definitions of the following identifiers conflict with those in another file: DOMException, Event, EventTarget, EventListenerOrEventListenerObject, ProgressEvent, TextDecoder, TextEncoder, AbortController, URLSearchParams, URL, ReadableStreamReader, CountQueuingStrategy, ByteLengthQueuingStrategy, BlobPart, Blob, File, FormDataEntryValue, FormData, HeadersInit, Headers, RequestInfo, RequestCache, RequestCredentials, RequestMode, RequestRedirect, ReferrerPolicy, BodyInit, RequestDestination, Request, ResponseType, Response, CloseEvent, WebSocket, BinaryType, CompileError, Global, Instance, LinkError, Memory, Module, RuntimeError, Table, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, ModuleImports, Imports, BufferSource, MessageEvent, ErrorEvent, CustomEvent, Window

Here is the example file

import { json, serve } from "https://deno.land/x/sift@0.3.0/mod.ts";

serve({
  "/": () => json({ message: "hello world" }),
  "api/create": () => json({ message: "created" }, { status: 201 }),
});

and here is the command I am running

deployctl run ./hello.js

Any ideas, what I could be doing wrong?

Thanks

Hi @twilson63.

Sift imports some functions from preact underneath hence the conflicts with DOM types. Thanks for opening the issue - I'll update the docs. The --libs flag of deployctl run will help you limit the typings to ns (Deno namespace) and fetchevent. In your case, run deployctl run --libs=ns,fetchevent ./hello.ts

And also this uncovers an issue in deployctl run. It shouldn't type check when the source is .js.