Skip to content

Commit

Permalink
feat(element): add typing support for JSX
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 18, 2024
1 parent a06f3cd commit 4735f29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adapters/discord/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export class DiscordMessageEncoder<C extends Context = Context> extends MessageE
}
const quote = await this.bot.getMessage(channelId, replyId)
if (!guildId) {
let c = await this.bot.internal.getChannel(channelId)
const c = await this.bot.internal.getChannel(channelId)
if (c.guild_id) guildId = c.guild_id
}
if (!guildId) {
Expand Down
2 changes: 1 addition & 1 deletion packages/element/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@satorijs/element",
"description": "Element Manipulation",
"version": "3.0.0",
"version": "3.1.1",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
Expand Down
28 changes: 28 additions & 0 deletions packages/element/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
import { arrayBufferToBase64, Awaitable, camelize, defineProperty, Dict, hyphenate, is, isNullable, makeArray } from 'cosmokit'

declare global {
namespace JSX {
interface IntrinsicElements {
message: {
id?: string
forward?: boolean
}
quote: {
id?: string
name?: string
avatar?: string
}
at: {
id?: string
name?: string
avatar?: string
role?: string
type?: string
}
sharp: {
id?: string
name?: string
avatar?: string
}
}
}
}

const kElement = Symbol.for('satori.element')

interface Element {
Expand Down

0 comments on commit 4735f29

Please sign in to comment.