Skip to content

Commit 62d0ede

Browse files
committed
style: fix lint errors
1 parent fddaa34 commit 62d0ede

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

decorator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import memo from './index'
2-
import type {MemoizeOptions, MemoizableFunction} from './index'
1+
import memo from './index.js'
2+
import type {MemoizeOptions, MemoizableFunction} from './index.js'
33

44
export default function memoize<A extends unknown[], R, T>(memoizeOptions: MemoizeOptions<A, R> = {}) {
5-
return (target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
5+
return (target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor): void => {
66
descriptor.value = memo(descriptor.value as MemoizableFunction<A, R, T>, memoizeOptions)
77
Object.defineProperty(target, propertyKey, descriptor)
88
}

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface MemoizeOptions<A extends unknown[], R> {
1414

1515
export type MemoizableFunction<A extends unknown[], R extends unknown, T extends unknown> = (this: T, ...args: A) => R
1616

17-
export function defaultHash(...args: unknown[]) {
17+
export function defaultHash(...args: unknown[]): string {
1818
// JSON.stringify ellides `undefined` and function values by default. We do not want that.
1919
return JSON.stringify(args, (_: unknown, v: unknown) => (typeof v === 'object' ? v : String(v)))
2020
}
@@ -29,6 +29,7 @@ export default function memoize<A extends unknown[], R extends unknown, T extend
2929
if (cache.has(id)) return cache.get(id)
3030
const result = fn.apply(this, args)
3131
if (result instanceof Promise) {
32+
// eslint-disable-next-line github/no-then
3233
result.catch(error => {
3334
cache.delete(id)
3435
throw error

0 commit comments

Comments
 (0)