Skip to content

Commit

Permalink
fix(syncRef) syncRef typing issue for boolean
Browse files Browse the repository at this point in the history
useSyncRef with two boolean needed a transform.
Updated Equal type to properly compare boolean

See: microsoft/TypeScript#27024 (comment)
  • Loading branch information
s-montigny-desautels committed Nov 15, 2023
1 parent 656fe54 commit 7a1af39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/shared/syncRef/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,9 @@ describe('syncRef', () => {
syncRef(refNumBoolean, ref0, {
direction: 'rtl',
})

const bool0 = ref(false)
const bool1 = ref(false)
syncRef(bool0, bool1)
})
})
2 changes: 1 addition & 1 deletion packages/shared/syncRef/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type SpecificFieldPartial<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T,
/**
* A = B
*/
type Equal<A, B> = A extends B ? (B extends A ? true : false) : false
type Equal<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false

/**
* A ∩ B ≠ ∅
Expand Down

0 comments on commit 7a1af39

Please sign in to comment.