From 3b0926476f10ff41604205b2e43c43d1c33b0fa5 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Sat, 19 Oct 2024 20:01:57 -0500 Subject: [PATCH] fix type error --- src/App.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 20f1dd5..a0a3a7d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,7 +6,7 @@ import "katex/dist/katex.min.css"; import Point from "./components/Point"; import Path from "./components/Path"; import { SettingsBox } from "./SettingsContext"; -import { useCallback, useState } from "react"; +import { useCallback } from "react"; import { atom, useAtom, useSetAtom } from "jotai"; // https://threejs.org/manual/#en/align-html-elements-to-3d @@ -45,7 +45,8 @@ function getInitialValue() { export const stateAtom = atom<{ [_: string]: string }>(getInitialValue()); -export const updateStateAtom = atom(null, (get, set, newValue) => { +export const updateStateAtom = atom(null, (_, set, newValue) => { + // @ts-ignore set(stateAtom, newValue); location.hash = btoa(JSON.stringify(newValue)); }); @@ -79,7 +80,9 @@ const defaultValues: [string, string] = Object.fromEntries([ ]); function parseCoord(s: string): coord { - return offset(s.split("").map((n) => parseInt(n))); + // @ts-ignore + const t: [number, number, number] = s.split("").map((n) => parseInt(n)); + return offset(t); } function parsePath(s: string): [coord, coord] {