@tscircuit/props 0.0.539 → 0.0.540
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/index.d.ts +19 -19
- package/dist/index.js.map +1 -1
- package/lib/components/chip.ts +4 -4
- package/lib/components/spicemodel.ts +3 -3
- package/package.json +1 -1
package/lib/components/chip.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { distance, supplier_name } from "circuit-json"
|
|
2
2
|
import type { Distance } from "lib/common/distance"
|
|
3
|
-
import type {
|
|
3
|
+
import type { SpiceModelProps } from "lib/components/spicemodel"
|
|
4
4
|
import {
|
|
5
5
|
type CommonComponentProps,
|
|
6
6
|
commonComponentProps,
|
|
@@ -38,7 +38,7 @@ export interface PinCompatibleVariant {
|
|
|
38
38
|
supplierPartNumber?: SupplierPartNumbers
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export type
|
|
41
|
+
export type SpiceModelElement = ReactElement<SpiceModelProps>
|
|
42
42
|
|
|
43
43
|
export interface ChipPropsSU<
|
|
44
44
|
PinLabel extends SchematicPinLabel = SchematicPinLabel,
|
|
@@ -71,7 +71,7 @@ export interface ChipPropsSU<
|
|
|
71
71
|
*/
|
|
72
72
|
noConnect?: readonly PinLabel[] | PinLabel[]
|
|
73
73
|
connections?: Connections<PinLabel>
|
|
74
|
-
spiceModel?:
|
|
74
|
+
spiceModel?: SpiceModelElement
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export type ChipProps<PinLabelMap extends PinLabelsProp | string = string> =
|
|
@@ -135,7 +135,7 @@ const connectionsProp = z
|
|
|
135
135
|
.custom<Connections>()
|
|
136
136
|
.pipe(z.record(z.string(), connectionTarget))
|
|
137
137
|
|
|
138
|
-
const spicemodelElement = z.custom<
|
|
138
|
+
const spicemodelElement = z.custom<SpiceModelElement>(
|
|
139
139
|
(v) => !!v && typeof v === "object" && "type" in v && "props" in v,
|
|
140
140
|
)
|
|
141
141
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expectTypesMatch } from "lib/typecheck"
|
|
2
2
|
import { z } from "zod"
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface SpiceModelProps {
|
|
5
5
|
source: string
|
|
6
6
|
spicePinMapping?: Record<string, string>
|
|
7
7
|
}
|
|
@@ -11,5 +11,5 @@ export const spicemodelProps = z.object({
|
|
|
11
11
|
spicePinMapping: z.record(z.string(), z.string()).optional(),
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
type
|
|
15
|
-
expectTypesMatch<
|
|
14
|
+
type InferredSpiceModelProps = z.input<typeof spicemodelProps>
|
|
15
|
+
expectTypesMatch<SpiceModelProps, InferredSpiceModelProps>(true)
|