Skip to content

Commit

Permalink
no need to make a Set
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed Jan 31, 2025
1 parent 87bb47c commit 9c85dd1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const makeInternalProp = <T>(name: string) => {
};
};

const serverKeysProp = makeInternalProp<Set<string>>("serverKeys");
const serverKeysProp = makeInternalProp<string[]>("serverKeys");

export function createEnv<
TPrefix extends TPrefixFormat,
Expand Down Expand Up @@ -268,8 +268,6 @@ export function createEnv<

const parsed = parseWithDictionary(finalSchema, runtimeEnv);

const serverKeys = new Set(Object.keys(_server));

const onValidationError =
opts.onValidationError ??
((issues) => {
Expand Down Expand Up @@ -301,17 +299,19 @@ export function createEnv<
};

// a map of keys to the preset we got them from
const serverKeys = Object.keys(_server);

const presetsByKey: Record<string, Record<string, unknown> | undefined> = {};

const extendedObj = (opts.extends ?? []).reduce((acc, curr) => {
for (const key in curr) {
presetsByKey[key] = curr;
acc[key] = curr[key];
}
const serverKeys = serverKeysProp.getValue(curr);
if (serverKeys) {
const presetServerKeys = serverKeysProp.getValue(curr);
if (presetServerKeys) {
// these are keys that the proxy should handle but won't be exposed on the client
for (const key of serverKeys) {
for (const key of presetServerKeys) {
presetsByKey[key] = curr;
}
}
Expand Down

0 comments on commit 9c85dd1

Please sign in to comment.