@traversable/schema
    Preparing search index...
    writeable: (type: Any, options?: deepEqual.Options) => string

    Type declaration

      • (type: Any, options?: deepEqual.Options): string
      • Derive a "writeable" (stringified) "deep equal" function from an ArkType schema.

        A "deep equal" function (see also, Equal) is similar to lodash's isEqual function, except more performant, because when the shape of the values being compared is known ahead of time, we can optimize ahead of time, and only check what's necessary.

        Note that the deep equal function generated by ark.deepEqual assumes that both values have already been validated. Passing unvalidated values to the function might result in undefined behavior.

        ark.deepEqual.writeable accepts an optional configuration object as its second argument; documentation for those options are available via hover on autocompletion.

        See also:

        Parameters

        Returns string

        import { ark } from '@traversable/arktype'

        const deepEqual = ark.deepEqual.writeable(
        type({
        street1: 'string',
        "street2?": 'string',
        city: 'string',
        }),
        { typeName: 'Address' }
        )

        console.log(deepEqual)
        // =>
        // type Address = { street1: string; street2?: string; city: string; }
        // function deepEqual(x: Address, y: Address) {
        // if (x === y) return true;
        // if (x.street1 !== y.street1) return false;
        // if (x.street2 !== y.street2) return false;
        // if (x.city !== y.city) return false;
        // return true;
        // }