fix type error

This commit is contained in:
Michael Zhang 2024-10-19 20:01:57 -05:00
parent 8687f60b0e
commit 3b0926476f

View file

@ -6,7 +6,7 @@ import "katex/dist/katex.min.css";
import Point from "./components/Point"; import Point from "./components/Point";
import Path from "./components/Path"; import Path from "./components/Path";
import { SettingsBox } from "./SettingsContext"; import { SettingsBox } from "./SettingsContext";
import { useCallback, useState } from "react"; import { useCallback } from "react";
import { atom, useAtom, useSetAtom } from "jotai"; import { atom, useAtom, useSetAtom } from "jotai";
// https://threejs.org/manual/#en/align-html-elements-to-3d // 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 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); set(stateAtom, newValue);
location.hash = btoa(JSON.stringify(newValue)); location.hash = btoa(JSON.stringify(newValue));
}); });
@ -79,7 +80,9 @@ const defaultValues: [string, string] = Object.fromEntries([
]); ]);
function parseCoord(s: string): coord { 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] { function parsePath(s: string): [coord, coord] {