fix: Resolve TypeScript build errors in PatternCanvas and imports

- Fix PenData import to use correct source (types/machine instead of penParser)
- Add explicit return type annotations for map callbacks in PatternCanvas
- Add parentheses around arrow function parameters to satisfy linter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Henrik 2025-12-13 23:38:13 +01:00
parent 8c3e177ea6
commit abf7b9a67f
2 changed files with 6 additions and 5 deletions

View file

@ -292,11 +292,11 @@ export function PatternCanvas() {
}} }}
> >
<Stitches <Stitches
stitches={pesData.penStitches.stitches.map((s, i) => { stitches={pesData.penStitches.stitches.map((s, i): [number, number, number, number] => {
// Convert PEN stitch format {x, y, flags, isJump} to PES format [x, y, cmd, colorIndex] // Convert PEN stitch format {x, y, flags, isJump} to PES format [x, y, cmd, colorIndex]
const cmd = s.isJump ? 0x10 : 0; // MOVE flag if jump const cmd = s.isJump ? 0x10 : 0; // MOVE flag if jump
const colorIndex = pesData.penStitches.colorBlocks.find( const colorIndex = pesData.penStitches.colorBlocks.find(
b => i >= b.startStitch && i <= b.endStitch (b) => i >= b.startStitch && i <= b.endStitch
)?.colorIndex ?? 0; )?.colorIndex ?? 0;
return [s.x, s.y, cmd, colorIndex]; return [s.x, s.y, cmd, colorIndex];
})} })}
@ -315,10 +315,10 @@ export function PatternCanvas() {
<Group x={localPatternOffset.x} y={localPatternOffset.y}> <Group x={localPatternOffset.x} y={localPatternOffset.y}>
<CurrentPosition <CurrentPosition
currentStitchIndex={sewingProgress.currentStitch} currentStitchIndex={sewingProgress.currentStitch}
stitches={pesData.penStitches.stitches.map((s, i) => { stitches={pesData.penStitches.stitches.map((s, i): [number, number, number, number] => {
const cmd = s.isJump ? 0x10 : 0; const cmd = s.isJump ? 0x10 : 0;
const colorIndex = pesData.penStitches.colorBlocks.find( const colorIndex = pesData.penStitches.colorBlocks.find(
b => i >= b.startStitch && i <= b.endStitch (b) => i >= b.startStitch && i <= b.endStitch
)?.colorIndex ?? 0; )?.colorIndex ?? 0;
return [s.x, s.y, cmd, colorIndex]; return [s.x, s.y, cmd, colorIndex];
})} })}

View file

@ -1,6 +1,7 @@
import type { WorkerMessage, WorkerResponse } from '../workers/patternConverter.worker'; import type { WorkerMessage, WorkerResponse } from '../workers/patternConverter.worker';
import PatternConverterWorker from '../workers/patternConverter.worker?worker'; import PatternConverterWorker from '../workers/patternConverter.worker?worker';
import { parsePenData, type PenData } from './penParser'; import { parsePenData } from './penParser';
import type { PenData } from '../types/machine';
export type PyodideState = 'not_loaded' | 'loading' | 'ready' | 'error'; export type PyodideState = 'not_loaded' | 'loading' | 'ready' | 'error';