Add typecheck
This commit is contained in:
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
import type { User as PUser } from '@prisma/client';
|
||||
|
||||
declare module '#auth-utils' {
|
||||
type User = Pick<PUser, 'id' | 'role' | 'name'>;
|
||||
// eslint-disable-next-line
|
||||
interface User extends Pick<PUser, 'id' | 'role' | 'name'> {}
|
||||
interface UserSession {
|
||||
user: User;
|
||||
loggedInAt: string | Date;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @ts-expect-error weird bun import with nuxt
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { checkSlug, parseSlug, type SlugRecord } from './slugcheck';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RouteParamsGeneric } from '#vue-router';
|
||||
import type { RouteParamsGeneric } from 'vue-router';
|
||||
|
||||
export type Slug = { name: string; id: number };
|
||||
export type SlugRecord = Record<string, Slug>;
|
||||
@@ -16,12 +16,13 @@ export function parseSlug(slug: string): null | Slug {
|
||||
const { name, id } = result.groups!;
|
||||
|
||||
return {
|
||||
name: name
|
||||
.substring(0, name.length - 1)
|
||||
.split('-')
|
||||
.map((w) => `${w.substring(0, 1).toUpperCase()}${w.substring(1)}`)
|
||||
.join(' '),
|
||||
id: parseInt(id)
|
||||
name:
|
||||
name
|
||||
?.substring(0, name.length - 1)
|
||||
.split('-')
|
||||
.map((w) => `${w.substring(0, 1).toUpperCase()}${w.substring(1)}`)
|
||||
.join(' ') ?? '',
|
||||
id: parseInt(id!)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user