Skip to content

Commit ba54dc4

Browse files
committed
refactor(rest): fold the thank-you answer's drop checks into two ablatable rules
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzzJHmF6J8Rdez8TWu
1 parent cc92f75 commit ba54dc4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/rest/src/form-routes.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,12 @@ function thankYouAnswerFields(
136136
const fields: Record<string, string | number> = {};
137137
let kept = 0;
138138
for (const name of names) {
139-
// An OWN declaration only: a name such as `constructor` must not find
140-
// the map's prototype.
141-
const type = Object.prototype.hasOwnProperty.call(declared, name) ? declared[name]?.type : undefined;
139+
// A name that is no declared field (a system column, a prototype key
140+
// such as `constructor`) has no string `type` here: dropped.
141+
const type = declared[name]?.type;
142142
if (typeof type !== 'string' || !RUNTIME_OWNED_FIELD_TYPES.has(type)) continue;
143-
if (!Object.prototype.hasOwnProperty.call(record, name)) continue;
143+
// Absent (masked, stripped, never generated), `null`, or any other
144+
// shape: dropped.
144145
const value = (record as Record<string, unknown>)[name];
145146
if (typeof value !== 'string' && typeof value !== 'number') continue;
146147
fields[name] = value;

0 commit comments

Comments
 (0)