Skip to content

Conversation

@jasonkuhrt
Copy link

@jasonkuhrt jasonkuhrt commented Feb 3, 2021

What:

Colocate the TS typings originally found here.

Why:

Incremental migration to TS. Reboot/Redo of #516.

How:

Have started by copying what's currently published on npm. We can continue to iterate after an initial release with this colocated.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@vercel
Copy link

vercel bot commented Feb 3, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/8y4bjqz6u
✅ Preview: https://next-auth-git-fork-jasonkuhrt-improve-co-locate-ts-typings.nextauthjs.vercel.app

@vercel vercel bot temporarily deployed to Preview February 3, 2021 20:32 Inactive
@vercel vercel bot temporarily deployed to Preview February 3, 2021 20:37 Inactive
@vercel vercel bot temporarily deployed to Preview February 3, 2021 20:46 Inactive
@balazsorban44 balazsorban44 added docs Relates to documentation TypeScript Issues relating to TypeScript labels Feb 3, 2021
getUser(id: string): Promise<TUser | null>
getUserByEmail(email: string): Promise<TUser | null>
getUserByProviderAccountId(
createUser: (profile: TProfile) => Promise<TUser>
Copy link
Author

@jasonkuhrt jasonkuhrt Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I disagree with this change by the linter. It changes autocompletion. It makes these appear as properties instead of methods (the icon) at least in VSCode. The problem is that properties can be callable or not. It just makes the autocomplete less usable, because it is harder to know the callables from the non-callables in the API.

@balazsorban44
Copy link
Member

balazsorban44 commented Feb 6, 2021

So after our internal discussion, I don't want to accept this PR in this form, but I would be very happy if you started typing params and return types on internal functions with JSDoc notation, and maybe some of the user-facing ones as well. If you want to be sure everything is typed in a file, just add a temporary // @ts-check comment at the top. 😉

Interfaces can be added in .d.ts files, but I would like to wait with adding them to package.json/types just yet, until maybe we have full coverage, and we figured out a good way to send through certain types the whole "tree" (module augmentation vs generics vs ???).

Also, I am very open to adding some kind of a script that extracts interfaces/JSDoc comments from the codebase and keeps our docs updated! Right now we have to explain the same functions over and over again, which can lead to inconsistencies really fast!

Thanks again for the chat!

@jasonkuhrt
Copy link
Author

@balazsorban44 yep! Thanks for your time as well!

@jasonkuhrt jasonkuhrt closed this Feb 8, 2021
@jasonkuhrt jasonkuhrt deleted the improve/co-locate-ts-typings branch February 8, 2021 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Relates to documentation TypeScript Issues relating to TypeScript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants