Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/websafe/convert-to-typescript-component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { convertEasyEdaJsonToCircuitJson } from "lib/convert-easyeda-json-to-tsc
import {
type BetterEasyEdaJson,
EasyEdaJsonSchema,
type RawEasyEdaJson,
} from "lib/schemas/easy-eda-json-schema"
import { normalizeManufacturerPartNumber } from "lib/utils/normalize-manufacturer-part-number"
import { getEasyEdaCadModelPlacement } from "../get-easyeda-cad-model-placement"
Expand All @@ -23,7 +24,12 @@ const getGeneratedComponentType = (
return "chip"
}

export const convertRawEasyToTsx = async ({ rawEasy }: { rawEasy: any }) => {
type ConvertRawEasyToTsxInput = RawEasyEdaJson | { rawEasy: RawEasyEdaJson }

export const convertRawEasyToTsx = async (input: ConvertRawEasyToTsxInput) => {
// The public API and CLI pass raw EasyEDA JSON directly. Keep accepting the
// temporary wrapped form too so existing callers are not broken.
const rawEasy = "rawEasy" in input ? input.rawEasy : input
const betterEasy = EasyEdaJsonSchema.parse(rawEasy)
const result = await convertBetterEasyToTsx({
betterEasy,
Expand Down
Loading
Loading