@sanity/types 6.9.0 → 6.9.1-next.10

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +9 -13
  2. package/package.json +4 -4
package/lib/index.d.ts CHANGED
@@ -2122,22 +2122,18 @@ type InitialValueProperty<Params, Value> = Value | InitialValueResolver<Params,
2122
2122
  * If the schema has not been run through `inferFromSchema` from
2123
2123
  * `sanity/validation` then value could be a function.
2124
2124
  *
2125
- * `inferFromSchema` mutates the schema converts this value to an array of
2126
- * `Rule` instances.
2125
+ * `inferFromSchema` mutates the schema and converts this value to an array of
2126
+ * `Rule` instances, _except_ for context-aware validation (a function declaring a
2127
+ * `context` parameter), which stays a function so it can be re-evaluated against
2128
+ * the value being validated.
2127
2129
  *
2128
2130
  * @privateRemarks
2129
2131
  *
2130
- * Usage of the schema inside the studio will almost always be from the compiled
2131
- * `createSchema` function. In this case, you can cast the value or throw to
2132
- * narrow the type. E.g.:
2133
- *
2134
- * ```ts
2135
- * if (typeof type.validation === 'function') {
2136
- * throw new Error(
2137
- * `Schema type "${type.name}"'s \`validation\` was not run though \`inferFromSchema\``
2138
- * )
2139
- * }
2140
- * ```
2132
+ * This means a compiled schema can still hold a function here, so do not treat
2133
+ * that as a sign the schema was never compiled. To read rules outside of document
2134
+ * validation, normalize on demand with `normalizeValidationRules(type)` and be
2135
+ * ready for it to throw, since context-aware validation may dereference a context
2136
+ * that only exists while validating. `getValidationRule` does this.
2141
2137
  *
2142
2138
  * @public
2143
2139
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/types",
3
- "version": "6.9.0",
3
+ "version": "6.9.1-next.10",
4
4
  "description": "Type definitions for common Sanity data structures",
5
5
  "keywords": [
6
6
  "cms",
@@ -44,9 +44,9 @@
44
44
  "typescript": "^7.0.2",
45
45
  "vite": "^8.2.0",
46
46
  "vitest": "^4.1.10",
47
- "@repo/tsconfig": "6.9.0",
48
- "@repo/test-config": "6.9.0",
49
- "@repo/tsdown.config": "6.9.0"
47
+ "@repo/tsconfig": "6.9.1-next.10+38e1996530",
48
+ "@repo/test-config": "6.9.1-next.10+38e1996530",
49
+ "@repo/tsdown.config": "6.9.1-next.10+38e1996530"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@types/react": "*"