Skip to content

Record with t.RegExp preserves unmatching properties #18

Open
@dodas

Description

@dodas

What version of Elysia is running?

1.3.1

What platform is your computer?

Darwin 24.2.0 arm64 arm

What steps can reproduce the bug?

import { Type as t } from "@sinclair/typebox";
import { createMirror } from "exact-mirror";

const schema = t.Record(t.RegExp("^custom[A-Z]"), t.Any());
const mirror = createMirror(schema);

const clean = mirror({ random: true, customProp: true });

What is the expected behavior?

console.log(mirror);
// { customProp: true }

Using typebox's Value.Clean() produces the expected result:

import { Type as t } from "@sinclair/typebox";
import { Value } from "@sinclair/typebox/value";

const schema = t.Record(t.RegExp("^custom[A-Z]"), t.Any());
const clean = Value.Clean(schema, { random: true, customProp: true });

console.log(mirror);
// { customProp: true }

What do you see instead?

console.log(mirror);
// { random: true, customProp: true }

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions