Skip to content

Commit

Permalink
fix: fix ci/cd type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
4x8Matrix committed Nov 19, 2024
1 parent 8da8101 commit 2e18319
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions packages/builders/src/message/message.luau
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ export type Message = typeof(Message.Prototype) & {
content: string?,
nonce: string?,
tts: boolean?,
embeds: { embed.JSON }?,
embeds: { embed.JSON },
allowedMentions: allowedMention.JSON?,
messageReference: reference.JSON?,
components: { button.JSON | textInput.JSON | selectMenu.JSON | actionRow.JSON }?,
stickerIds: { string }?,
components: { button.JSON | textInput.JSON | selectMenu.JSON | actionRow.JSON },
stickerIds: { string },
-- files[n]
-- payloadJson
attachments: { attachment.JSON }?,
attachments: { attachment.JSON },
flags: number?,
enforceNonce: boolean?,
poll: poll.JSON?,
Expand Down
2 changes: 1 addition & 1 deletion packages/classes/src/application/command/option.luau
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type Option = typeof(Option.Prototype) & {
type: apiTypes.ApplicationCommandOptionType,
name: string,
nameLocalizations: { [apiTypes.LanguageLocales]: string }?,
description: string,
description: string?,
descriptionLocalizations: { [apiTypes.LanguageLocales]: string }?,
required: boolean?,
choices: { choice.Choice }?,
Expand Down
4 changes: 2 additions & 2 deletions packages/classes/src/guild/onboarding/option.luau
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ function Option.Interface.new(optionData: apiTypes.PromptOptionObject): Option
end

export type Option = typeof(Option.Prototype) & {
id: apiTypes.Snowflake,
id: apiTypes.Snowflake?,
channelIds: { apiTypes.Snowflake },
roleIds: { apiTypes.Snowflake },
emoji: emoji.Emoji?,
title: string,
title: string?,
description: string?,
}

Expand Down
8 changes: 4 additions & 4 deletions packages/classes/src/guild/onboarding/prompt.luau
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export type Prompt = typeof(Prompt.Prototype) & {
id: apiTypes.Snowflake?,
type: guildTypes.OnboardingPromptType,
options: { option.Option },
title: string,
singleSelect: boolean,
required: boolean,
inOnboarding: boolean,
title: string?,
singleSelect: boolean?,
required: boolean?,
inOnboarding: boolean?,
}

return Prompt.Interface
4 changes: 2 additions & 2 deletions packages/classes/src/guild/welcomeScreenChannel.luau
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function WelcomeScreenChannel.Interface.new(roleTagData: apiTypes.WelcomeScreenC
end

export type WelcomeScreenChannel = typeof(WelcomeScreenChannel.Prototype) & {
channelId: apiTypes.Snowflake,
description: string,
channelId: apiTypes.Snowflake?,
description: string?,
emojiId: apiTypes.Snowflake?,
emojiName: string?,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/classes/src/guild/widget/widgetSettings.luau
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function WidgetSettings.Interface.new(widgetSettingsData: apiTypes.GuildWidgetSe
end

export type WidgetSettings = typeof(WidgetSettings.Prototype) & {
enabled: boolean,
enabled: boolean?,
channelId: apiTypes.Snowflake?,
}

Expand Down
13 changes: 8 additions & 5 deletions packages/classes/src/resolved.luau
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
]]

local apiTypes = require("@api-types/apiTypes")
local channelTypes = require("@api-types/channel")

local user = require("@classes/user")
local member = require("@classes/guild/member")
Expand All @@ -13,6 +14,8 @@ local attachment = require("@classes/attachment")
local message = require("@classes/message/message")
local state = require("@classes/state")

local constructChannelFromData = require("@utils/constructChannelFromData")

local Resolved = {}

Resolved.Interface = {}
Expand All @@ -31,9 +34,9 @@ function Resolved.Prototype.sync(self: Resolved, resolvedData: apiTypes.Resolved
self.roles[id] = role.new(roleData)
end

-- for id, channelData in next, resolvedData.channels or {} do
-- self.channels[id] = channel.new(channelData)
-- end
for id, channelData in next, resolvedData.channels or {} do
self.channels[id] = constructChannelFromData(self.state, channelData) :: channelTypes.AbstractChannel
end

for id, messageData in next, resolvedData.messages or {} do
self.messages[id] = message.new(self.state, messageData)
Expand All @@ -52,7 +55,7 @@ function Resolved.Interface.new(state: state.State, resolvedData: apiTypes.Resol
users = {},
members = {},
roles = {},
-- channels = {},
channels = {},
messages = {},
attachments = {},
} :: Resolved,
Expand All @@ -70,7 +73,7 @@ export type Resolved = typeof(Resolved.Prototype) & {
users: { [apiTypes.Snowflake]: user.User },
members: { [apiTypes.Snowflake]: member.Member },
roles: { [apiTypes.Snowflake]: role.Role },
-- channels: { [apiTypes.Snowflake]: unknown }, -- fixme: we can't type the channels since channels require this message class.
channels: { [apiTypes.Snowflake]: channelTypes.AbstractChannel },
messages: { [apiTypes.Snowflake]: Message },
attachments: { [apiTypes.Snowflake]: attachment.Attachment },
}
Expand Down
3 changes: 1 addition & 2 deletions packages/rest/src/request.luau
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ function Request.Prototype.executeAsync<Resolve>(self: Request): future.Future<{
end
end

-- FIXME: This table satisfies FetchParams, yet it somehow cannot be casted
local request = net.request({
url = baseUrl,
method = self.method,
body = self.body,
headers = headerTable,
})
} :: net.FetchParams)

if not request.ok then
error(setmetatable({
Expand Down
1 change: 1 addition & 0 deletions packages/std-polyfills/src/net.luau
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local LuneNet = require("@lune/net")

export type WebSocket = LuneNet.WebSocket
export type FetchResponse = LuneNet.FetchResponse
export type FetchParams = LuneNet.FetchParams

setmetatable(Net, { __index = LuneNet })

Expand Down

0 comments on commit 2e18319

Please sign in to comment.