Skip to content

Commit 1b8023d

Browse files
committed
fix: update OAuth2UserInfo type and enable strict type checking in tsconfig
1 parent c6f480f commit 1b8023d

4 files changed

Lines changed: 20 additions & 28 deletions

File tree

index.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
import type { OAuth2Adapter } from "adminforth";
1+
import type { OAuth2Adapter, OAuth2UserInfo } from "adminforth";
2+
23

3-
type OAuth2UserInfoLocal = {
4-
email: string;
5-
provider?: string;
6-
subject?: string;
7-
phone?: string;
8-
meta?: Record<string, any>;
9-
fullName?: string;
10-
profilePictureUrl?: string | null;
11-
externalUserId?: string | number | null;
12-
};
134
import type { GithubEmail } from "./types.js";
145
export default class AdminForthAdapterGithubOauth2 implements OAuth2Adapter {
156
private clientID: string;
@@ -34,9 +25,7 @@ export default class AdminForthAdapterGithubOauth2 implements OAuth2Adapter {
3425
return url;
3526
}
3627

37-
async getTokenFromCode(code: string, redirect_uri: string): Promise<OAuth2UserInfoLocal> {
38-
console.log('Getting token from code:', code);
39-
28+
async getTokenFromCode(code: string, redirect_uri: string): Promise<OAuth2UserInfo> {
4029
// Exchange code for token
4130
const tokenResponse = await fetch('https://github.com/login/oauth/access_token', {
4231
method: 'POST',

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"dependencies": {
2727
"typescript": "^5.7.3"
2828
},
29+
"peerDependencies": {
30+
"adminforth": "^3.2.4"
31+
},
2932
"release": {
3033
"plugins": [
3134
"@semantic-release/commit-analyzer",

pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outDir": "./dist", /* Specify an output folder for all emitted files. */
77
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. */
88
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
9-
"strict": false, /* Enable all strict type-checking options. */
9+
"strict": true, /* Enable all strict type-checking options. */
1010
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
1111
},
1212
"exclude": ["node_modules", "dist", "custom"], /* Exclude files from compilation. */

0 commit comments

Comments
 (0)