-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report a bug
π Search Terms
onUndeclaredKey
π§© Context
- ArkType version: 2.1.22
- TypeScript version (5.1+): 5.9.2
- Other context you think may be relevant (JS flavor, OS, etc.):
π§βπ» Repro
import { type } from "arktype"
const Thing = type({
name: "string",
sample: type
.or(
type({ title: '"OK"', "description?": "string" }),
type({ title: '"KO"', "description?": "string" })
)
.onUndeclaredKey("delete")
.pipe((v) => {
if (v.description) v.description = "Hello" + v.description
return v
})
})
const out = Thing({
name: "TypeScript",
sample: {
title: "OK",
description: "World",
_meta: "SHOULD BE REMOVED"
}
})
Additional comments
- If
.onUndeclaredKey
is used after.pipe
, it works fine. - If the level 1 is a simple object schema, it works fine, only bugged when used on a
type.or()
schema.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
To do