Skip to content

Commit 4569a38

Browse files
committed
feat: drop support for symbol keys in object schemas
1 parent ea596fb commit 4569a38

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

packages/internal/src/steps/looseObject/looseObject.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { IsEqual, IsExactlyAnyOrUnknown, Simplify, ValueOf } from '../../sh
33
import { implStepPlugin } from '../../core'
44

55
declare namespace Internal {
6-
export type Struct = Record<PropertyKey, Use<Valchecker> | [optional: Use<Valchecker>]>
6+
export type Struct = Record<string, Use<Valchecker> | [optional: Use<Valchecker>]>
77

88
export type Async<
99
S extends Struct,
@@ -98,9 +98,9 @@ export const looseObject = implStepPlugin<PluginDef>({
9898
params: [struct, message],
9999
}) => {
100100
// Pre-compute metadata for each property to avoid repeated lookups
101-
const keys = Reflect.ownKeys(struct)
101+
const keys = Object.keys(struct)
102102
const keysLen = keys.length
103-
const propsMeta: Array<{ key: PropertyKey, isOptional: boolean, schema: Use<Valchecker> }> = []
103+
const propsMeta: Array<{ key: string, isOptional: boolean, schema: Use<Valchecker> }> = []
104104

105105
for (let i = 0; i < keysLen; i++) {
106106
const key = keys[i]!
@@ -127,7 +127,7 @@ export const looseObject = implStepPlugin<PluginDef>({
127127
}
128128

129129
const issues: ExecutionIssue<any, any>[] = []
130-
const output: Record<PropertyKey, any> = Object.defineProperties(
130+
const output: Record<string, any> = Object.defineProperties(
131131
{},
132132
Object.getOwnPropertyDescriptors(value),
133133
)

packages/internal/src/steps/object/object.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { IsEqual, IsExactlyAnyOrUnknown, Simplify, ValueOf } from '../../sh
33
import { implStepPlugin } from '../../core'
44

55
declare namespace Internal {
6-
export type Struct = Record<PropertyKey, Use<Valchecker> | [optional: Use<Valchecker>]>
6+
export type Struct = Record<string, Use<Valchecker> | [optional: Use<Valchecker>]>
77

88
export type Async<
99
S extends Struct,
@@ -101,9 +101,9 @@ export const object = implStepPlugin<PluginDef>({
101101
params: [struct, message],
102102
}) => {
103103
// Pre-compute metadata for each property to avoid repeated lookups
104-
const keys = Reflect.ownKeys(struct)
104+
const keys = Object.keys(struct)
105105
const keysLen = keys.length
106-
const propsMeta: Array<{ key: PropertyKey, isOptional: boolean, schema: Use<Valchecker> }> = []
106+
const propsMeta: Array<{ key: string, isOptional: boolean, schema: Use<Valchecker> }> = []
107107

108108
for (let i = 0; i < keysLen; i++) {
109109
const key = keys[i]!
@@ -130,7 +130,7 @@ export const object = implStepPlugin<PluginDef>({
130130
}
131131

132132
const issues: ExecutionIssue<any, any>[] = []
133-
const output: Record<PropertyKey, any> = {}
133+
const output: Record<string, any> = {}
134134

135135
// Inline processPropResult for better performance
136136
// First pass: process synchronously until we hit async

packages/internal/src/steps/strictObject/strictObject.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { IsEqual, IsExactlyAnyOrUnknown, Simplify, ValueOf } from '../../sh
33
import { implStepPlugin } from '../../core'
44

55
declare namespace Internal {
6-
export type Struct = Record<PropertyKey, Use<Valchecker> | [optional: Use<Valchecker>]>
6+
export type Struct = Record<string, Use<Valchecker> | [optional: Use<Valchecker>]>
77

88
export type Async<
99
S extends Struct,
@@ -29,7 +29,7 @@ declare namespace Internal {
2929

3030
export type Issue<S extends Struct = never>
3131
= | ExecutionIssue<'strictObject:expected_object', { value: unknown }>
32-
| ExecutionIssue<'strictObject:unexpected_keys', { value: unknown, keys: PropertyKey[] }>
32+
| ExecutionIssue<'strictObject:unexpected_keys', { value: unknown, keys: string[] }>
3333
| (
3434
IsEqual<Struct, never> extends true
3535
? never
@@ -103,9 +103,9 @@ export const strictObject = implStepPlugin<PluginDef>({
103103
params: [struct, message],
104104
}) => {
105105
// Pre-compute metadata for each property to avoid repeated lookups
106-
const keys = Reflect.ownKeys(struct)
106+
const keys = Object.keys(struct)
107107
const keysLen = keys.length
108-
const propsMeta: Array<{ key: string | symbol, isOptional: boolean, schema: Use<Valchecker> }> = []
108+
const propsMeta: Array<{ key: string, isOptional: boolean, schema: Use<Valchecker> }> = []
109109

110110
for (let i = 0; i < keysLen; i++) {
111111
const key = keys[i]!
@@ -131,9 +131,9 @@ export const strictObject = implStepPlugin<PluginDef>({
131131
})
132132
}
133133

134-
const ownKeysSet = new Set(Reflect.ownKeys(value))
134+
const ownKeysSet = new Set(Object.keys(value))
135135
const issues: ExecutionIssue<any, any>[] = []
136-
const output: Record<PropertyKey, any> = {}
136+
const output: Record<string, any> = {}
137137

138138
// Inline processPropResult for better performance
139139
// First pass: process synchronously until we hit async

0 commit comments

Comments
 (0)