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

feat: improve and export typescript definitions #1393

Closed
wants to merge 1 commit into from
Closed

feat: improve and export typescript definitions #1393

wants to merge 1 commit into from

Conversation

euxn23
Copy link

@euxn23 euxn23 commented Feb 28, 2021

What:

Add typings, improved based on DefinitelyTyped's implementation, and expose from this Library.

Why:

Now @types/next-auth is provided by DefinitelyTyped, but that implementation is behinded from this JS implementation. (such as new NextAuth configration, Requests, Responses and Providers)
I improved type definitions and made pull request on DefinitelyTyped repository(DefinitelyTyped/DefinitelyTyped#51469), but as you see, result of CI is broken.
The reason is next-auth types depends on next types in next package, not in @types/next. Type definitions of next uses ts-ignore in a few files, but DefinitelyTyped not allow ts-ignore and there is no way to avoid ts-ignore banning in contributor's config.

As described above, now it is too difficult to pass all CI on DefinitelyTyped, maybe for everybody, without help and fixing DefinitelyTyped. This problem had been discussed in microsoft/dtslint#297 (comment) , but discussion seems to be stoped.
So I think this is the time to provide type definitions in next-auth own package.

How:

I wrote types reading JS implementations honestly.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@lluia
Thanks to provide current type definitions!
I rewrited too much files, so I'll appreciate if you reviewed and checked there is no degrade.

@vercel
Copy link

vercel bot commented Feb 28, 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/2CxZqwogmyw6FuJX2VfztdTUbg91
✅ Preview: https://next-auth-git-fork-euxn23-feature-improveandexportt-1371b6.vercel.app

@vercel vercel bot temporarily deployed to Preview February 28, 2021 09:32 Inactive
@github-actions github-actions bot added core Refers to `@auth/core` pages providers labels Feb 28, 2021
@vercel vercel bot temporarily deployed to Preview February 28, 2021 09:33 Inactive
@vercel vercel bot temporarily deployed to Preview February 28, 2021 09:37 Inactive
@vercel vercel bot temporarily deployed to Preview February 28, 2021 09:38 Inactive
@balazsorban44
Copy link
Member

balazsorban44 commented Feb 28, 2021

Right now, our main priority is not built-in TypeScript support (although there are internal minor improvements sporadically, utilizing JSDoc and .d.ts files). If you are not satisfied with the type definitions provided from @types/next-auth, I suggest you open PRs against https://github.com/DefinitelyTyped/DefinitelyTyped instead.

Currently, it is just too much overhead for the maintainers to also take care of TS.

Regarding @types/next, it is deprecated and thus I decided not to use it:

image

You can take up the @ts-ignore issues in https://github.com/vercel/next.js/issues

@balazsorban44 balazsorban44 added upstream The issue dervies from one of next-auth dependencies TypeScript Issues relating to TypeScript labels Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` pages providers TypeScript Issues relating to TypeScript upstream The issue dervies from one of next-auth dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants