Skip to content

Commit d488513

Browse files
committed
fix: ts errors
1 parent b925cf2 commit d488513

File tree

7 files changed

+11
-6
lines changed

7 files changed

+11
-6
lines changed

docs/.vitepress/components/ModuleContributors.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script setup lang="ts">
22
import { ref } from 'vue'
33
4-
const contributors = ref<{ id: string, avatar_url: string, login: string, html_url: string }[]>([])
4+
interface Contributor { id: string, avatar_url: string, login: string, html_url: string }
5+
const contributors = ref<Contributor[]>([])
56
67
fetch('https://api.github.com/repos/rrd108/nuxt-users/contributors')
78
.then(res => res.json())

eslint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export default createConfigForNuxt({
2626
// Disable trailing commas
2727
'comma-dangle': 'off',
2828
'@stylistic/comma-dangle': 'off',
29+
// Disable unified-signatures due to bug with Vue files
30+
'@typescript-eslint/unified-signatures': 'off',
2931
},
3032
},
3133
)

playground/pages/register.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
<script setup lang="ts">
2121
import type { UserWithoutPassword } from 'nuxt-users/utils'
2222
23+
type RegistrationUser = Omit<UserWithoutPassword, 'active'>
24+
2325
// Handle successful registration
24-
const onRegistrationSuccess = (data: { user: Omit<UserWithoutPassword, 'active'>, message: string }) => {
26+
const onRegistrationSuccess = (data: { user: RegistrationUser, message: string }) => {
2527
console.log('Registration successful:', data)
2628
// Additional success handling if needed
2729
}

src/runtime/server/services/password.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export const resetPassword = async (
164164
const [hour, minute, second] = timePart.split(':').map(Number)
165165

166166
if (!year || !month || !day || hour === undefined || minute === undefined || second === undefined) {
167-
console.log(`[Nuxt Users] Invalid timestamp components`)
167+
console.log('[Nuxt Users] Invalid timestamp components')
168168
return false
169169
}
170170

src/runtime/server/services/registration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export const confirmUserEmail = async (
238238
const [hour, minute, second] = timePart.split(':').map(Number)
239239

240240
if (!year || !month || !day || hour === undefined || minute === undefined || second === undefined) {
241-
console.log(`[Nuxt Users] Invalid timestamp components`)
241+
console.log('[Nuxt Users] Invalid timestamp components')
242242
return false
243243
}
244244

test/google-oauth-flow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ describe('Google OAuth Complete Flow Integration', () => {
260260

261261
// Verify token expiration
262262
const tokens = await db.sql`SELECT expires_at FROM personal_access_tokens WHERE token = ${token}` as { rows: PersonalAccessToken[] }
263-
const expiresAt = new Date(tokens.rows[0]?.expires_at!)
263+
const expiresAt = new Date(tokens.rows[0]?.expires_at ?? new Date())
264264
const now = new Date()
265265
const daysDifference = Math.floor((expiresAt.getTime() - now.getTime()) / (1000 * 60 * 60 * 24))
266266

test/unit/utils.google-oauth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import bcrypt from 'bcrypt'
1010

1111
// Mock Google Auth Library
1212
vi.mock('google-auth-library', () => ({
13-
OAuth2Client: vi.fn(function(this: any) {
13+
OAuth2Client: vi.fn(function (this: Record<string, unknown>) {
1414
this.generateAuthUrl = vi.fn()
1515
this.getToken = vi.fn()
1616
this.setCredentials = vi.fn()

0 commit comments

Comments
 (0)