Skip to content

Commit be75b54

Browse files
committed
fix(site): fix type errors
1 parent 49bb1bb commit be75b54

File tree

6 files changed

+43
-27
lines changed

6 files changed

+43
-27
lines changed

pnpm-lock.yaml

Lines changed: 27 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
},
1616
"dependencies": {
1717
"highlight.js": "^11.9.0",
18-
"jsfast": "workspace:*"
18+
"jsfast": "1.0.0-beta.18"
1919
}
2020
}

site/src/fadeIn.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FastjsDomList, dom } from "jsfast";
1+
import { FastjsDom, FastjsDomList, dom } from "jsfast";
22

33
let calc = 0,
44
first = true;
@@ -26,7 +26,8 @@ export function renderFadeIn() {
2626
if (el.getAttr("fade-in-done")) continue;
2727
if (
2828
window.scrollY <= offset &&
29-
window.scrollY + window.innerHeight > offset + el.get("offsetHeight")
29+
window.scrollY + window.innerHeight >
30+
offset + (el as FastjsDom<any>).get("offsetHeight")
3031
) {
3132
setTimeout(() => {
3233
el.setAttr("fade-in", "true");

site/src/pages/home/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ async function animation(root: FastjsDom) {
1313
);
1414

1515
for (let key = 0; key < animationList.length; key++) {
16-
const el = animationList[key];
16+
const el = animationList[key] as FastjsDom<HTMLDivElement>;
1717
const content = el.getAttr("content");
1818
const move = el.getAttr("move");
1919
await delay(200);
2020

2121
if (content) {
2222
await typeText(content, el);
2323
} else if (move !== null) {
24-
const target = root.next<FastjsDom>(`[move-target="${key}"]`);
24+
const target = root.next<FastjsDom<HTMLDivElement>>(
25+
`[move-target="${key}"]`
26+
);
2527
const hide = target.getAttr("hide");
2628

2729
target.setStyle("width", hide + "px");
@@ -58,7 +60,7 @@ function delay(ms: number) {
5860
return new Promise((resolve) => setTimeout(resolve, ms));
5961
}
6062

61-
async function typeText(text: string, el: FastjsDom) {
63+
async function typeText(text: string, el: FastjsDom<any>) {
6264
let textArr = text.split("");
6365
for (let i = 0; i < textArr.length; i++) {
6466
el.html((el.html() + textArr[i]).replace(/ /g, "&nbsp;"));

site/src/pages/sponsor/card.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function newCard(params: Member): FastjsDom {
3838
params.button?.forEach((button) => {
3939
const color = button.color || "white";
4040
const icon = dom
41-
.newEl("a", {
41+
.newEl<HTMLAnchorElement>("a", {
4242
class: "button",
4343
href: button.link,
4444
target: "_blank",
@@ -50,7 +50,10 @@ export function newCard(params: Member): FastjsDom {
5050
.text(button.text);
5151
if (button.icon) {
5252
icon.insert(
53-
dom.newEl("img", { src: button.icon, alt: button.text }),
53+
dom.newEl<HTMLImageElement>("img", {
54+
src: button.icon,
55+
alt: button.text
56+
}),
5457
"first"
5558
);
5659
}
@@ -59,7 +62,7 @@ export function newCard(params: Member): FastjsDom {
5962
params.social?.forEach((social) => {
6063
card.next(".social")!.insert(
6164
dom
62-
.newEl("a", {
65+
.newEl<HTMLAnchorElement>("a", {
6366
class: "social",
6467
href: social.link,
6568
target: "_blank"

site/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
},
1717
"types": ["vite/client"]
1818
},
19-
"include": ["src/**/*.ts"],
20-
"exclude": ["node_modules"]
19+
"include": ["src/**/*.ts"]
2120
}

0 commit comments

Comments
 (0)