From cdc32905f77118de6085fc654f1e52779de19199 Mon Sep 17 00:00:00 2001 From: Jan Vlnas Date: Mon, 2 Jan 2023 16:17:12 +0100 Subject: [PATCH 1/3] fix(types): Optional deps @types/passport{-oauth2} --- package.json | 4 ++++ yarn.lock | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4994132..b1e95a7 100644 --- a/package.json +++ b/package.json @@ -49,5 +49,9 @@ }, "dependencies": { "passport-oauth2": "^1.6.1" + }, + "optionalDependencies": { + "@types/passport": "1.x", + "@types/passport-oauth2": ">=1.4" } } diff --git a/yarn.lock b/yarn.lock index dfa77e2..e2793a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -233,7 +233,7 @@ dependencies: "@types/node" "*" -"@types/passport-oauth2@^1.4.11": +"@types/passport-oauth2@>=1.4": version "1.4.11" resolved "https://registry.yarnpkg.com/@types/passport-oauth2/-/passport-oauth2-1.4.11.tgz#fbca527ecb44258774d17bcb251630c321515fa9" integrity sha512-KUNwmGhe/3xPbjkzkPwwcPmyFwfyiSgtV1qOrPBLaU4i4q9GSCdAOyCbkFG0gUxAyEmYwqo9OAF/rjPjJ6ImdA== @@ -242,7 +242,7 @@ "@types/oauth" "*" "@types/passport" "*" -"@types/passport@*", "@types/passport@^1.0.11": +"@types/passport@*", "@types/passport@1.x": version "1.0.11" resolved "https://registry.yarnpkg.com/@types/passport/-/passport-1.0.11.tgz#d046b41e28b280f4e7994614fb976e9b449cb7c6" integrity sha512-pz1cx9ptZvozyGKKKIPLcVDVHwae4hrH5d6g5J+DkMRRjR3cVETb4jMabhXAUbg3Ov7T22nFHEgaK2jj+5CBpw== From 054c5ff9233c8c74c59dead2804ca71e9cd19731 Mon Sep 17 00:00:00 2001 From: Jan Vlnas Date: Mon, 2 Jan 2023 16:17:35 +0100 Subject: [PATCH 2/3] chore(types): Explicit type import from passport --- src/models/profile.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/profile.ts b/src/models/profile.ts index 6d7026e..98302bf 100644 --- a/src/models/profile.ts +++ b/src/models/profile.ts @@ -1,9 +1,9 @@ -import * as passport from 'passport'; +import type { Profile as PassportProfile } from 'passport'; /** * @public */ -export interface Profile extends passport.Profile { +export interface Profile extends PassportProfile { username: string; profileUrl: string; } From 36621bd0833d829feb9338757b3346efd2ffd8b9 Mon Sep 17 00:00:00 2001 From: Jan Vlnas Date: Wed, 4 Jan 2023 10:54:26 +0100 Subject: [PATCH 3/3] docs(changelog): Add entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46561ad..c0b59b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Fixed +- TypeScript support: Added optional dependencies on `@types/passport-oauth2` and `@types/passport` for correct typing. ([#25](https://github.com/superfaceai/passport-twitter-oauth2/issues/25)) ## 1.2.2 - 2022-12-23 ### Fixed