MCPcopy Create free account
hub / github.com/codemix/graph / makeStrictType

Function makeStrictType

packages/graph/src/test/Graph.test.ts:758–776  ·  view source on GitHub ↗
(
  typeChecker: (value: unknown) => boolean,
  typeName: string,
)

Source from the content-addressed store, hash-verified

756
757// Helper to create a strict type validator
758function makeStrictType<T>(
759 typeChecker: (value: unknown) => boolean,
760 typeName: string,
761): StandardSchemaV1<T> {
762 return {
763 "~standard": {
764 version: 1,
765 vendor: "codemix-test",
766 validate: (value) => {
767 if (typeChecker(value)) {
768 return { value: value as T };
769 }
770 return {
771 issues: [{ message: `Expected ${typeName}, received ${typeof value}` }],
772 };
773 },
774 },
775 };
776}
777
778// Schema with strict type validation
779const strictSchema = {

Callers 1

Graph.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected