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

Pipes still run when child property has failed #1185

Closed
Dimava opened this issue Oct 28, 2024 · 1 comment
Closed

Pipes still run when child property has failed #1185

Dimava opened this issue Oct 28, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Dimava
Copy link
Contributor

Dimava commented Oct 28, 2024

Report a bug

πŸ”Ž Search Terms

🧩 Context

  • ArkType version:
  • TypeScript version (5.1+): rc21
  • Other context you think may be relevant (JS flavor, OS, etc.):

πŸ§‘β€πŸ’» Repro

import { type } from "../type/index.ts"

const $Item = type({
	type: "string",
	"additionalProperties?": "this",
	"description?": "string",
	"enum?": "string[]",
	"example?": "number|string|object|boolean",
	"items?": "this",
	"required?": "string[]"
})

const DescribedEnum = type({
	branches: "string", // type({ unit: "string" }).array().atLeastLength(1),
	meta: "string"
}).pipe((v, ctx) => {
	console.log(ctx.currentErrorCount, Object.keys(ctx.errors.byPath))
	console.log("DescribedEnum is expected to be a valid type, but is: ", v)
	return {
		//   ...
	}
}, $Item)
console.clear()
console.log(JSON.stringify(DescribedEnum.json))
const v = DescribedEnum({ domain: "number", meta: "A whole number;example:0" })
console.log(v + "")
@ssalbdivad
Copy link
Member

Fixed in 2.0.0-rc.23

@github-project-automation github-project-automation bot moved this from Implemented to Done (merged or closed) in arktypeio Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done (merged or closed)
Development

Successfully merging a pull request may close this issue.

2 participants