fix: 120 type errors
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m47s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m47s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Graph, NodeDefinition, NodeType } from "./types";
|
||||
import type { Graph, NodeDefinition, NodeType } from "./types";
|
||||
|
||||
export interface NodeRegistry {
|
||||
/**
|
||||
|
||||
@@ -6,11 +6,23 @@ const DefaultOptionsSchema = z.object({
|
||||
setting: z.string().optional(),
|
||||
label: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
accepts: z.array(z.string()).optional(),
|
||||
accepts: z
|
||||
.array(
|
||||
z.union([
|
||||
z.literal("float"),
|
||||
z.literal("integer"),
|
||||
z.literal("boolean"),
|
||||
z.literal("select"),
|
||||
z.literal("seed"),
|
||||
z.literal("vec3"),
|
||||
z.literal("geometry"),
|
||||
z.literal("path"),
|
||||
]),
|
||||
)
|
||||
.optional(),
|
||||
hidden: z.boolean().optional(),
|
||||
});
|
||||
|
||||
|
||||
export const NodeInputFloatSchema = z.object({
|
||||
...DefaultOptionsSchema.shape,
|
||||
type: z.literal("float"),
|
||||
@@ -40,7 +52,7 @@ export const NodeInputSelectSchema = z.object({
|
||||
...DefaultOptionsSchema.shape,
|
||||
type: z.literal("select"),
|
||||
options: z.array(z.string()).optional(),
|
||||
value: z.number().optional(),
|
||||
value: z.string().optional(),
|
||||
});
|
||||
|
||||
export const NodeInputSeedSchema = z.object({
|
||||
@@ -74,7 +86,7 @@ export const NodeInputSchema = z.union([
|
||||
NodeInputSeedSchema,
|
||||
NodeInputVec3Schema,
|
||||
NodeInputGeometrySchema,
|
||||
NodeInputPathSchema
|
||||
NodeInputPathSchema,
|
||||
]);
|
||||
|
||||
export type NodeInput = z.infer<typeof NodeInputSchema>;
|
||||
|
||||
@@ -8,22 +8,6 @@ export const NodeTypeSchema = z
|
||||
|
||||
export type NodeType = z.infer<typeof NodeTypeSchema>;
|
||||
|
||||
export const NodeSchema = z.object({
|
||||
id: z.number(),
|
||||
type: NodeTypeSchema,
|
||||
tmp: z.any().optional(),
|
||||
props: z
|
||||
.record(z.string(), z.union([z.number(), z.array(z.number())]))
|
||||
.optional(),
|
||||
meta: z
|
||||
.object({
|
||||
title: z.string().optional(),
|
||||
lastModified: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
position: z.tuple([z.number(), z.number()]),
|
||||
});
|
||||
|
||||
export type Node = {
|
||||
tmp?: {
|
||||
depth?: number;
|
||||
@@ -55,6 +39,21 @@ export const NodeDefinitionSchema = z.object({
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const NodeSchema = z.object({
|
||||
id: z.number(),
|
||||
type: NodeTypeSchema,
|
||||
props: z
|
||||
.record(z.string(), z.union([z.number(), z.array(z.number())]))
|
||||
.optional(),
|
||||
meta: z
|
||||
.object({
|
||||
title: z.string().optional(),
|
||||
lastModified: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
position: z.tuple([z.number(), z.number()]),
|
||||
});
|
||||
|
||||
export type NodeDefinition = z.infer<typeof NodeDefinitionSchema> & {
|
||||
execute(input: Int32Array): Int32Array;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user