Skip to content

Commit fb3f0ac

Browse files
committedDec 19, 2023
Types fix
1 parent 1591788 commit fb3f0ac

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed
 

‎package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-afc",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "Allows you to significantly simplify the optimization of functional react components",
55
"keywords": [
66
"react",

‎src/compatible.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Actions, ObjectState, ObjectStateSetters, ReduxSelectors, State }
99
import * as AFC from './index'
1010

1111
/** Allow to use inline callbacks */
12-
export function $<T extends (...args: any[]) => any>(callback: T) {
12+
export function $<T extends (...args: any[]) => any>(callback: T): T {
1313
if (inAFCRender()) return AFC.$(callback)
1414
return callback
1515
}

‎src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function afcMemo<P extends object>(constructor: Constructor<P>, options?:
6666
}
6767

6868
/** Allow to use inline callbacks */
69-
export function $<T extends (...args: any[]) => any>(callback: T) {
69+
export function $<T extends (...args: any[]) => any>(callback: T): T {
7070
const { callbacks } = getRenderData()
7171

7272
if (callbacks.arr.length <= callbacks.next) {
@@ -75,7 +75,7 @@ export function $<T extends (...args: any[]) => any>(callback: T) {
7575
return callback
7676
}
7777
else {
78-
return callbacks.arr[callbacks.next++]
78+
return callbacks.arr[callbacks.next++] as T
7979
}
8080
}
8181

0 commit comments

Comments
 (0)
Please sign in to comment.