@remotion/zod-types-v3v4.0.426
@remotion/zod-types 自 Remotion v4.0.426 起使用 Zod v4 创建模式。
此包适用于如果你正在使用 Zod v3.22.3 并且想要将函数如 zColor() 与 Zod v3.22.3 模式组合使用的情况。
🌐 This package is for if you are using Zod v3.22.3 and want to compose functions like zColor() with Zod v3.22.3 schemas.
安装
🌐 Installation
- Remotion CLI
- npm
- bun
- pnpm
- yarn
npx remotion add @remotion/zod-types-v3
This assumes you are currently using v4.0.431 of Remotion.npm i --save-exact @remotion/zod-types-v3@4.0.431
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.431 of Remotion.pnpm i @remotion/zod-types-v3@4.0.431
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.431 of Remotion.bun i @remotion/zod-types-v3@4.0.431
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.This assumes you are currently using v4.0.431 of Remotion.yarn --exact add @remotion/zod-types-v3@4.0.431
Also update
remotion and all `@remotion/*` packages to the same version.Remove all
^ character in front of the version numbers of it as it can lead to a version conflict.用法
🌐 Usage
Using @remotion/zod-types-v3 with Zod v3import {z } from 'zod'; // zod = 3.22.3 import {zColor } from '@remotion/zod-types-v3'; export constmySchema =z .object ({color :zColor (), });
该包导出与 @remotion/zod-types 相同的 zColor()、zTextarea() 和 zMatrix() 函数,但它们返回 Zod v3.22.3 架构类型。
🌐 The package exports the same zColor(), zTextarea(), and zMatrix() functions as @remotion/zod-types, but they return Zod v3.22.3 schema types.
何时使用
🌐 When to use
在 Zod v4 中使用 @remotion/zod-types :
🌐 Use @remotion/zod-types with Zod v4:
import {z } from 'zod'; // zod = 4.x.x
import {zColor } from '@remotion/zod-types';
export const mySchema = z .object ({
color : zColor (),
});如果你没有嵌套模式,请使用 @remotion/zod-types:
🌐 Use @remotion/zod-types if you are not nesting schemas:
import {zColor } from '@remotion/zod-types';
import {visualControl } from '@remotion/studio';
export const myVisualControl = visualControl ('my-color', '#fff', zColor ());在 Zod v3.22.3 中使用 @remotion/zod-types-v3:
🌐 Use @remotion/zod-types-v3 with Zod v3.22.3:
import {z } from 'zod'; // zod = 3.22.3
import {zColor } from '@remotion/zod-types-v3';
export const mySchema = z .object ({
color : zColor (),
});其他 Zod 3.x.x 版本不受官方支持。
🌐 Other Zod 3.x.x versions are not officially supported.
另请参阅
🌐 See also