slack-bolt icon indicating copy to clipboard operation
slack-bolt copied to clipboard

Demo usage code fails

Open Alex-Muirhead opened this issue 4 years ago • 1 comments

Running the demonstration usage code with no modifications gives the following errors:

error: TS2612 [ERROR]: Property 'resolve' will overwrite the base property in 'Deferred<undefined>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.
    public readonly resolve!: () => void;
                    ~~~~~~~
    at https://deno.land/x/[email protected]/tools/Deferred.ts:57:21

TS2322 [ERROR]: Type '{ token: string | undefined; text: string; channel: string; } | { token: string | undefined; channel: string; }' is not assignable to type 'ChatPostMessageArguments'.
  Property 'text' is missing in type '{ token: string | undefined; channel: string; }' but required in type 'ChatPostMessageArguments'.
                const postMessageArguments: ChatPostMessageArguments = typeof message === "string"
                      ~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/x/[email protected]/src/App.ts:762:23

    'text' is declared here.
        text: string
        ~~~~
        at https://deno.land/x/[email protected]/src/methods.ts:948:5

Found 2 errors.

I'm using the following version of deno:

deno 1.11.4+ed16f43 (canary, x86_64-unknown-linux-gnu)
v8 9.1.269.35
typescript 4.3.2

Alex-Muirhead avatar Jul 02 '21 10:07 Alex-Muirhead

I also got the same error. Version: Deno v1.16.4

So now I run it with --no-check only at runtime to go through the type check. This has allowed me to use it without any problems.

In Deno v1.17.0 or later, I heard that you can use --no-check=remote to skip type checking of dependent libraries only. So, I think it is possible to use this to check the type of the code you write, and deal with it on the user side. https://github.com/denoland/deno/pull/12766

gatchan0807 avatar Dec 10 '21 07:12 gatchan0807