grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.21k stars 110 forks source link

Project doesn't compile on Deno 1.20.3 #172

Closed darvesh closed 2 years ago

darvesh commented 2 years ago

How to reproduce:

deno upgrade
deno cache "https://deno.land/x/grammy@v1.7.0/mod.ts"

Version:

deno --version                                                                                                                                    
deno 1.20.3 (release, x86_64-unknown-linux-gnu)
v8 10.0.139.6
typescript 4.6.2

Logs:

Check https://deno.land/x/grammy@v1.7.0/mod.ts
error: TS2769 [ERROR]: No overload matches this call.
  Overload 1 of 2, '(input: string | Request, init?: RequestInit | undefined): Promise<Response>', gave the following error.
    Argument of type 'string | URL' is not assignable to parameter of type 'string | Request'.
      Type 'URL' is not assignable to type 'string | Request'.  Overload 2 of 2, '(input: URL, init?: RequestInit | undefined): Promise<Response>', gave the following error.
    Argument of type 'string | URL' is not assignable to parameter of type 'URL'.
      Type 'string' is not assignable to type 'URL'.
    const { body } = await fetch(url);
                                 ~~~
    at https://deno.land/x/grammy@v1.7.0/platform.deno.ts:134:34

TS2322 [ERROR]: Type '((root: string, token: string, method: string) => URL) | ((root: string, token: string, method: string) => string)' is not assignable to type '(root: string, token: string, method: string) => URL'.
  Type '(root: string, token: string, method: string) => string' is not assignable to type '(root: string, token: string, method: string) => URL'.
    Type 'string' is not assignable to type 'URL'.
            buildUrl: options.buildUrl ??
            ~~~~~~~~
    at https://deno.land/x/grammy@v1.7.0/core/client.ts:207:13

    The expected type comes from property 'buildUrl' which is declared here on type 'Required<ApiClientOptions>'
        buildUrl?: (
        ~~~~~~~~
        at https://deno.land/x/grammy@v1.7.0/core/client.ts:131:5

Found 2 errors.
ivcosla commented 2 years ago

Same issue

KnorpelSenf commented 2 years ago

It works on 1.20.2 as stated in https://t.me/grammyjs/41202

darvesh commented 2 years ago

@KnorpelSenf we can close this issue now?

KnorpelSenf commented 2 years ago

Yes!

KnorpelSenf commented 2 years ago

It seems like Deno will fix this on their side soon: https://github.com/denoland/deno/pull/14113#issuecomment-1080750014