fix: SELECT.one also returns undefined - #514
Conversation
There was a problem hiding this comment.
The line 179 is not in the diff (it was not changed), so a review comment cannot be posted on it directly. The inconsistency is still worth mentioning in the summary.
The PR adds | undefined to all SELECT_one return types. The existing discussion thread on line 155 is already actively debating the core trade-off (whether null should be kept or replaced entirely, and whether matching plugin behaviour justifies the union). The one additional technical observation — that the primary-key overload in SELECT_from (line 179) still returns only T | null without undefined, creating an asymmetry with the newly widened SELECT_one overloads — cannot be posted as a diff comment because that line is unchanged. This asymmetry should be addressed in the ongoing discussion or in a follow-up.
Summary: The change is minimal and targeted, but the existing review thread highlights an unresolved design question (keep both null and undefined, or consolidate to one) that should be settled before merging. Additionally, consider whether the analogous primary-key overload in SELECT_from needs the same | undefined treatment for a consistent API contract.
PR Bot Information
Version: 1.28.2
- File Content Strategy: Full file content
- Event Trigger:
pull_request.ready_for_review - LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
00ad88e0-851b-11f1-8335-bd0f27a90554
Fix:
SELECT.oneReturn Type Now IncludesundefinedBug Fix
🐛 Corrected the return type of
SELECT.oneoverloads to accurately reflect that the result can also beundefined(in addition tonull), matching the actual runtime behavior.Changes
apis/ql.d.ts: Updated multipleSELECT_oneoverload signatures to change the awaited return type fromT | nulltoT | null | undefined. This affects the following overloads:(entityType: T, projection?)— withArrayConstructable(entityType: T, primaryKey, projection?)— withArrayConstructable(entity: T[], projection?)(entity: T[], primaryKey, projection?)(entity: { new(): T }, projection?)(entity: { new(): T }, primaryKey, projection?)PR Bot Information
Version:
1.28.2anthropic--claude-4.6-sonnetpull_request.ready_for_review00ad88e0-851b-11f1-8335-bd0f27a90554