Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing incoming type errors from ts 5.1.3 #130

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@react-facet/core/src/helpers/multiObserve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Facet, Unsubscribe, Cleanup, NO_VALUE, ExtractFacetValues } from '../ty
* We pass the dependencies of the callback as the second argument so we can leverage the eslint-plugin-react-hooks option for additionalHooks.
* Having this as the second argument allows the linter to work.
*/
export function multiObserve<Y extends Facet<unknown>[], T extends [...Y]>(
export function multiObserve<Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y]>(
effect: (...args: ExtractFacetValues<T>) => void | Cleanup,
facets: T,
) {
Expand Down
6 changes: 3 additions & 3 deletions packages/@react-facet/core/src/hooks/useFacetCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Facet, NO_VALUE, ExtractFacetValues, NoValue } from '../types'
* We pass the dependencies of the callback as the second argument so we can leverage the eslint-plugin-react-hooks option for additionalHooks.
* Having this as the second argument allows the linter to work.
*/
export function useFacetCallback<M, Y extends Facet<unknown>[], T extends [...Y], K extends [...unknown[]]>(
export function useFacetCallback<M, Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y], K extends [...unknown[]]>(
callback: (...args: ExtractFacetValues<T>) => (...args: K) => M,
dependencies: unknown[],
facets: T,
Expand All @@ -31,13 +31,13 @@ export function useFacetCallback<M, Y extends Facet<unknown>[], T extends [...Y]
* We pass the dependencies of the callback as the second argument so we can leverage the eslint-plugin-react-hooks option for additionalHooks.
* Having this as the second argument allows the linter to work.
*/
export function useFacetCallback<M, Y extends Facet<unknown>[], T extends [...Y], K extends [...unknown[]]>(
export function useFacetCallback<M, Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y], K extends [...unknown[]]>(
callback: (...args: ExtractFacetValues<T>) => (...args: K) => M,
dependencies: unknown[],
facets: T,
): (...args: K) => M | NoValue

export function useFacetCallback<M, Y extends Facet<unknown>[], T extends [...Y], K extends [...unknown[]]>(
export function useFacetCallback<M, Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y], K extends [...unknown[]]>(
callback: (...args: ExtractFacetValues<T>) => (...args: K) => M,
dependencies: unknown[],
facets: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-facet/core/src/hooks/useFacetEffect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Facet, Unsubscribe, Cleanup, NO_VALUE, ExtractFacetValues } from '../ty
import { cancelScheduledTask, scheduleTask } from '../scheduler'

export const createUseFacetEffect = (useHook: typeof useEffect | typeof useLayoutEffect) => {
return function <Y extends Facet<unknown>[], T extends [...Y]>(
return function <Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y]>(
effect: (...args: ExtractFacetValues<T>) => void | Cleanup,
dependencies: unknown[],
facets: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-facet/core/src/hooks/useFacetMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EqualityCheck, Facet, NoValue, ExtractFacetValues } from '../types'
*
* @returns a new facet definition that can be consumed as a regular facet
*/
export function useFacetMap<M, Y extends Facet<unknown>[], T extends [...Y]>(
export function useFacetMap<M, Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y]>(
selector: (...args: ExtractFacetValues<T>) => M | NoValue,
dependencies: unknown[],
facets: T,
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-facet/core/src/hooks/useFacetMemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EqualityCheck, Facet, NoValue, ExtractFacetValues } from '../types'
*
* @returns a new facet definition that can be consumed as a regular facet
*/
export function useFacetMemo<M, Y extends Facet<unknown>[], T extends [...Y]>(
export function useFacetMemo<M, Y extends[Facet<unknown>, ...Facet<unknown>[]], T extends [...Y]>(
selector: (...args: ExtractFacetValues<T>) => M | NoValue,
dependencies: unknown[],
facets: T,
Expand Down