clerk / clerk-docs

The documentation content for Clerk, an authentication and user management platform.
https://clerk.com/docs
103 stars 420 forks source link

User createdAt docs? #911

Closed ishaangandhi closed 5 months ago

ishaangandhi commented 6 months ago

Preliminary Checks

Reproduction

https://github.com/ignore-me

Publishable key

pk_ignore_me

Description

https://clerk.com/docs/references/javascript/user/user says a user.createdAt is a Date, but in node_modules/.pnpm/@clerk+backend@0.38.3_react@18.2.0/node_modules/@clerk/backend/dist/types/api/resources/User.d.ts, it says User.createdAt is a number:

readonly createdAt: number;

I'm not sure which one is right.

Environment

n/a
dimkl commented 6 months ago

Hello @ishaangandhi Those 2 types are not the same. The reference docs https://clerk.com/docs/references/javascript/user/user are related to our @clerk/clerk-js package and the window.Clerk.user value or the useUser() return value. This paragraph in the docs link is meant to distinguish that it's used in @clerk/clerk-js

The ClerkJS SDK provides some helper methods on the User object to help retrieve and update user information and authentication status.

The @clerk/backend type for User is a bit different since it may contain data that should not be available to the browser. Sometimes there are some inconsistencies due to human error, but sometimes they are intended. Thank you for the feedback, we will take a better look at this and check if we should update the type or not.

ishaangandhi commented 6 months ago

I mean, the Backend docs say the same thing:

createdAt   Date    Date when the user was first created.
dimkl commented 6 months ago

@ishaangandhi oops 😓 . i didn't see that. That's definitely something we should update.