fix: typing

This commit is contained in:
hypercross 2026-03-13 15:36:35 +08:00
parent c668dce348
commit 2e04934881
4 changed files with 24 additions and 3 deletions

View File

@ -127,7 +127,7 @@ export function PrintPreview(props: PrintPreviewProps) {
width={`${store.state.dimensions?.cardWidth || 56}mm`} width={`${store.state.dimensions?.cardWidth || 56}mm`}
height={`${store.state.dimensions?.cardHeight || 88}mm`} height={`${store.state.dimensions?.cardHeight || 88}mm`}
> >
<div xmlns="http://www.w3.org/1999/xhtml" class="w-full h-full bg-white"> <div class="w-full h-full bg-white" {...({ xmlns: 'http://www.w3.org/1999/xhtml' } as any)}>
<div <div
class="absolute" class="absolute"
style={{ style={{

View File

@ -17,7 +17,7 @@ interface TableRow {
customElement('md-table', { roll: false, remix: false }, (props, { element }) => { customElement('md-table', { roll: false, remix: false }, (props, { element }) => {
noShadowDOM(); noShadowDOM();
const [rows, setRows] = createSignal<CSV<TableRow>>([]); const [rows, setRows] = createSignal<CSV<TableRow>>([] as unknown as CSV<TableRow>);
const [activeTab, setActiveTab] = createSignal(0); const [activeTab, setActiveTab] = createSignal(0);
const [activeGroup, setActiveGroup] = createSignal<string | null>(null); const [activeGroup, setActiveGroup] = createSignal<string | null>(null);
const [bodyHtml, setBodyHtml] = createSignal(''); const [bodyHtml, setBodyHtml] = createSignal('');
@ -45,7 +45,8 @@ customElement('md-table', { roll: false, remix: false }, (props, { element }) =>
createEffect(() => { createEffect(() => {
const data = csvData(); const data = csvData();
if (data) { if (data) {
setRows(data as any[]); // 将加载的数据赋值给 rowsCSV 类型已经包含 sourcePath 等属性
setRows(data as unknown as CSV<TableRow>);
} }
}); });

View File

@ -3,6 +3,10 @@ import { For, Show, createEffect } from 'solid-js';
import type {TextResult, RuntimeResult, OptionsResult} from '../yarn-spinner/runtime/results'; import type {TextResult, RuntimeResult, OptionsResult} from '../yarn-spinner/runtime/results';
import { createYarnStore } from './stores/yarnStore'; import { createYarnStore } from './stores/yarnStore';
export interface YarnSpinnerProps {
start: string;
}
customElement<{start: string}>('md-yarn-spinner', {start: 'start'}, (props, { element }) => { customElement<{start: string}>('md-yarn-spinner', {start: 'start'}, (props, { element }) => {
noShadowDOM(); noShadowDOM();

16
src/global.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
/// <reference types="vite/client" />
interface WebpackContext {
(path: string): { default?: string } | string;
keys(): string[];
}
interface ImportMeta {
webpackContext(
directory: string,
options: {
recursive?: boolean;
regExp?: RegExp;
}
): WebpackContext;
}