Skip to content

Commit

Permalink
🏷️
Browse files Browse the repository at this point in the history
nanarino committed Oct 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0766cba commit ddb69be
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/components/T.astro
Original file line number Diff line number Diff line change
@@ -2,10 +2,9 @@
import escape from "src/scripts/server/escape"
import dataset from "src/scripts/server/dataset"
interface Props {
tag?: string
interface Props extends astroHTML.JSX.HTMLAttributes {
tag?: keyof astroHTML.JSX.DefinedIntrinsicElements
dataset?: Record<string, any>
[key: string]: any
}
const props = Astro.props
4 changes: 2 additions & 2 deletions src/scripts/server/dataset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function (dataset: Record<string, any>) {
const attrs: Record<`data-${string}`, any> = {}
const attrs: Record<`data-${string}`, string> = {}
for (const [k, v] of Object.entries(dataset)) {
Reflect.set(attrs, `data-${k}`, v)
Reflect.set(attrs, `data-${k}`, `${v}`)
}
return attrs
}

0 comments on commit ddb69be

Please sign in to comment.