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(ts): expose types from main package #1773

Merged
merged 23 commits into from
Apr 20, 2021
Merged

feat(ts): expose types from main package #1773

merged 23 commits into from
Apr 20, 2021

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Apr 19, 2021

What:

Migrating from DefinitelyTyped

Why:

Easier maintenance, improved developer experience. Having types directly in the main repo will ensure that those working on it have immediate access to the source code, and can test out their changes much more easily. It is structured in a way that should not collide with the source code.

How:

We are using a separate types folder, that does not collide with the src folder, where all the source code lives, in plain JS. This ensures that people with little TS knowledge or those who simply don't want to use it can also contribute in a meaningful way.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

Closes #1649

balazsorban44 and others added 13 commits April 4, 2021 22:08
* chore(types): move existing types to the repo
* feat(ts): expose types from the main package
* chore(deps): bring back `react-dom` version range
* chore(ts): cleanup deps and comments
* chore(ci): run types tests on a separate workflow
* chore(types): build types script

Adds a script that moves the declaration files we have in `./types` to `./dist` relative to the files they intend to type.

This is the first step, we still need to change what we declare in `package.json`, add the script to the CI pipeline if we're happy with it and figure out how to type `next-auth/jwt`.

* refactor(lint): fix build-types script
* chore(ts): remove unused imports

* refactor(ts): clean up CallbackOptions

* docs(ts): explain Module Augmentation

* docs(ts): don't use @ in folder name "types"

* test(ts): make jwt params optional

* docs(ts): fix typo (TypeScript -> NextAuth.js)
* style: move from ts-standard to eslint/prettier

* fix: install remaining eslint-config-standard peer deps

* fix: add remaining missing dependencies/config

Co-authored-by: Balázs Orbán <[email protected]>
Regarding ESLint / Prettier use and link to their VSCode extensions
* refactor(ts): deduplicate internal types

* refactor(ts): ease up providers typings

* test(ts): fix failing TS tests

* test(ts): rename TS property to fix test

* docs(ts): mention TS docs in README.md

* feat(ts): move/update client types

* refactor(TS): rename some types

* test(ts): fix client tests

* docs(ts): move function descriptions to .d.ts

* chore: fix lint error

* refactor(ts): separate internal types

* chore: simplify build-types script

* chore: update type import paths in src

* chore(build): create root files at build

* chore: remove unnecessary .npmignore

* chore: run prettier on types

* fix(ts): clean up jwt types

* fix(ts): make getToken return type depend on raw param

* docs(page): explain page errors, add theming note

* docs(ts): add JSDoc to NextAuthOptions props

* chore(ts): remove unused import

* docs(ts): change JSDOC docs notation

* refactor(build): extract module entries into enum

* chore(ts): move ClientSafeProvider

* chore(ts): simplify GetTokenParams generic

* style(lint): fix linting errors

* chore: re-add generic extension to GetTokenParams
@vercel
Copy link

vercel bot commented Apr 19, 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/6DP4R8dAHkgbV5JxmfyHjKv1TYCx
✅ Preview: https://next-auth-git-beta-nextauthjs.vercel.app

@github-actions github-actions bot added client Client related code core Refers to `@auth/core` docs Relates to documentation pages providers test Related to testing TypeScript Issues relating to TypeScript labels Apr 19, 2021
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:22 Inactive
@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters databases labels Apr 19, 2021
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:30 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:37 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:38 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:39 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 15:40 Inactive
@github-actions github-actions bot removed adapters Changes related to the core code concerning database adapters databases labels Apr 19, 2021
@vercel vercel bot temporarily deployed to Preview April 19, 2021 19:51 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 19:55 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 20:27 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 21:02 Inactive
@vercel vercel bot temporarily deployed to Preview April 19, 2021 21:04 Inactive
@balazsorban44 balazsorban44 merged commit 46b62d7 into main Apr 20, 2021
@balazsorban44 balazsorban44 deleted the beta branch April 20, 2021 10:20
@github-actions
Copy link

🎉 This PR is included in version 3.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 4.0.0-next.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
* chore: add beta to release flow/GH actions

* feat(ts): expose types from the package (nextauthjs#1665)

* chore(types): move existing types to the repo
* feat(ts): expose types from the main package
* chore(deps): bring back `react-dom` version range
* chore(ts): cleanup deps and comments
* chore(ci): run types tests on a separate workflow

* chore(ci): fix typo on types workflow

* fix(ts): correctly export sub-module types (nextauthjs#1677)

* chore(types): build types script

Adds a script that moves the declaration files we have in `./types` to `./dist` relative to the files they intend to type.

This is the first step, we still need to change what we declare in `package.json`, add the script to the CI pipeline if we're happy with it and figure out how to type `next-auth/jwt`.

* refactor(lint): fix build-types script

* fix(ts): add .d.ts sub-module files to package.json

nextauthjs#1677 seemed to miss this

* fix(built): typo in package.json

* fix(build): fix release

* feat(ts): support module augmentation (nextauthjs#1681)

* chore(ts): remove unused imports

* refactor(ts): clean up CallbackOptions

* docs(ts): explain Module Augmentation

* docs(ts): don't use @ in folder name "types"

* test(ts): make jwt params optional

* docs(ts): fix typo (TypeScript -> NextAuth.js)

* style: replace ts-standard with eslint/prettier (nextauthjs#1724)

* style: move from ts-standard to eslint/prettier

* fix: install remaining eslint-config-standard peer deps

* fix: add remaining missing dependencies/config

Co-authored-by: Balázs Orbán <[email protected]>

* docs(lint): update contributing.md (nextauthjs#1760)

Regarding ESLint / Prettier use and link to their VSCode extensions

* refactor(ts): de-duplicate types (nextauthjs#1690)

* refactor(ts): deduplicate internal types

* refactor(ts): ease up providers typings

* test(ts): fix failing TS tests

* test(ts): rename TS property to fix test

* docs(ts): mention TS docs in README.md

* feat(ts): move/update client types

* refactor(TS): rename some types

* test(ts): fix client tests

* docs(ts): move function descriptions to .d.ts

* chore: fix lint error

* refactor(ts): separate internal types

* chore: simplify build-types script

* chore: update type import paths in src

* chore(build): create root files at build

* chore: remove unnecessary .npmignore

* chore: run prettier on types

* fix(ts): clean up jwt types

* fix(ts): make getToken return type depend on raw param

* docs(page): explain page errors, add theming note

* docs(ts): add JSDoc to NextAuthOptions props

* chore(ts): remove unused import

* docs(ts): change JSDOC docs notation

* refactor(build): extract module entries into enum

* chore(ts): move ClientSafeProvider

* chore(ts): simplify GetTokenParams generic

* style(lint): fix linting errors

* chore: re-add generic extension to GetTokenParams

* fix(ts): extract EmailConfigServerOptions to interface

* fix(ts): use relative imports

* Merge branch 'main' into beta

* Merge main into beta

* fix(ts): fix typos, add more links to documentation

* test(ts): update JWT getToken test

* fix(build): fix tsconfig.json formatting

* test(ts): use absolute imports in test files

* fix(ts): add missing callbacks JSDoc

* docs: mention TS in FAQ, fix typos

* docs: fix some typos in the docs

Co-authored-by: Lluis Agusti <[email protected]>
Co-authored-by: Nico Domino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client related code core Refers to `@auth/core` docs Relates to documentation pages providers test Related to testing TypeScript Issues relating to TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move types from DefinitivelyTyped to here 🙇🏽‍♂️
3 participants