refactor: ♻️ remove unnecessary unknown extends in generic
This commit is contained in:
parent
e44401415a
commit
021d9e689b
|
@ -1,7 +1,7 @@
|
|||
import type { PageProps } from '$fresh/server.ts'
|
||||
import { getCookies } from '@std/http/cookie'
|
||||
|
||||
type SessionEntry<T extends unknown = unknown> = {
|
||||
type SessionEntry<T = unknown> = {
|
||||
accessCount: number
|
||||
flash: boolean
|
||||
value: T
|
||||
|
@ -84,7 +84,7 @@ class Session {
|
|||
return this.#timestamp
|
||||
}
|
||||
|
||||
get<T extends unknown = unknown>(key: string): T | undefined {
|
||||
get<T = unknown>(key: string): T | undefined {
|
||||
this.#updateTimestamp()
|
||||
|
||||
const entry = this.#db.get(key)
|
||||
|
@ -103,7 +103,7 @@ class Session {
|
|||
this.#db.set(key, entry)
|
||||
return entry.value as T
|
||||
}
|
||||
set<T extends unknown = unknown>(key: string, value: T): void {
|
||||
set<T = unknown>(key: string, value: T): void {
|
||||
this.#updateTimestamp()
|
||||
|
||||
const entry = this.#db.get(key) as SessionEntry<T> | undefined
|
||||
|
@ -132,7 +132,7 @@ class Session {
|
|||
const keys = [...this.#db.keys()]
|
||||
return keys.map((key) => ([key, this.get(key)] as [string, unknown]))
|
||||
}
|
||||
flash<T extends unknown = unknown>(key: string, value: T) {
|
||||
flash<T = unknown>(key: string, value: T) {
|
||||
this.#updateTimestamp()
|
||||
|
||||
const entry = this.#db.get(key) as SessionEntry<T> | undefined
|
||||
|
|
Loading…
Reference in a new issue