Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: required() 可能会导致 union 行为异常 #48

Closed
idranme opened this issue Jun 24, 2023 · 2 comments
Closed

Bug: required() 可能会导致 union 行为异常 #48

idranme opened this issue Jun 24, 2023 · 2 comments

Comments

@idranme
Copy link

idranme commented Jun 24, 2023

export interface Config { }

export const Config: Schema<Config> = Schema.object({
  constants: Schema.dict(Schema.intersect([
    Schema.object({
      type: Schema.union(['foo', 'bar']).required(),
    }).description('基础配置'),
    Schema.union([
      Schema.object({
        type: Schema.const('foo').required(),
        value: Schema.number().default(114514),
        aaa: Schema.union(['bbb', 'ccc']).required()
      }).description('特殊配置 1'),
      Schema.object({
        type: Schema.const('bar').required(),
        text: Schema.string(),
        aaa: Schema.union(['bbb', 'ccc']).required()
      }).description('特殊配置 2'),
    ]),
  ])).description('常量列表')
}).description('常量设置')

问题:无法展开。

aaa: Schema.union(['bbb', 'ccc']).required() 删了就正常了。

@shigma shigma closed this as completed in 5383e68 Jun 24, 2023
@shigma
Copy link
Owner

shigma commented Jun 24, 2023

感谢反馈。Koishi 将在近期更新以修复此问题。

@idranme
Copy link
Author

idranme commented Jun 24, 2023

感谢反馈。Koishi 将在近期更新以修复此问题。

好耶!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants