Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: object results should have attribute values casted as well #433

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

cyjake
Copy link
Owner

@cyjake cyjake commented Feb 8, 2025

class Post {
  @Column(DataTypes.JSONB)
  extra: Record<string, unknown>
}

const [post] = await Post.select('extra', "JSON_EXTRACT(extra, '$.foo') AS foo");
console.log(typeof post.extra); // expected "object", actually got "string"

@cyjake cyjake requested a review from JimmyDaddy February 8, 2025 09:44
src/bone.js Show resolved Hide resolved
@cyjake cyjake force-pushed the fix-type-casting-on-object-results branch from f77f2a8 to 0cb9588 Compare February 8, 2025 09:50
Copy link

codecov bot commented Feb 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.77%. Comparing base (df1d77a) to head (0cb9588).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #433      +/-   ##
==========================================
- Coverage   96.79%   96.77%   -0.03%     
==========================================
  Files          45       45              
  Lines        3716     3718       +2     
  Branches       72       72              
==========================================
+ Hits         3597     3598       +1     
- Misses        105      106       +1     
  Partials       14       14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cyjake cyjake merged commit 6640ada into master Feb 10, 2025
5 of 6 checks passed
@cyjake cyjake deleted the fix-type-casting-on-object-results branch February 10, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants