import { cloud, lift, main } from "@wingcloud/framework";
import * as slack from "@winglibs/slack";
main((root) => {
let botToken = new cloud.Secret(root, "BotToken", {name: "bot-token"});
let inbox = new cloud.Bucket(root, "Inbox");
let slackBot = new slack.App(root, "SlackBot", { token: botToken});
inbox.onCreate(lift({ slackBot }).inflight(async ({ slackBot }, key) => {
console.log("Creating channel");
let channel = await slackBot.channel("check-the-bot");
channel.post(`New file: ${key} was uploaded`);
}));
});
This happened:
❯ wing compile main.ts
TS compilation failed:
main.ts:12:13 - error TS2339: Property 'post' does not exist on type 'Channel'.
12 channel.post(`New file: ${key} was uploaded`);
~~~~
I expected this:
Compilation to be successful
Is there a workaround?
I can cast Channel as any and it will work
import { cloud, lift, main } from "@wingcloud/framework";
import * as slack from "@winglibs/slack";
main((root) => {
let botToken = new cloud.Secret(root, "BotToken", {name: "bot-token"});
let inbox = new cloud.Bucket(root, "Inbox");
let slackBot = new slack.App(root, "SlackBot", { token: botToken});
inbox.onCreate(lift({ slackBot }).inflight(async ({ slackBot }, key) => {
console.log("Creating channel");
let channel = await slackBot.channel("check-the-bot") as any; // THE CAST
channel.post(`New file: ${key} was uploaded`);
}));
});
Anything else?
No response
Wing Version
0.74.24
Node.js Version
20
Platform(s)
MacOS
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
I tried this:
This happened:
I expected this:
Compilation to be successful
Is there a workaround?
I can cast Channel as any and it will work
Anything else?
No response
Wing Version
0.74.24
Node.js Version
20
Platform(s)
MacOS
Community Notes