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

refactor(vanilla): change all exported functions to 'function declarations' #1061

Merged
merged 1 commit into from
Feb 26, 2025
Merged
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
18 changes: 10 additions & 8 deletions src/vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,21 @@ export function ref<T extends object>(obj: T) {
// unstable APIs (subject to change without notice)
// ------------------------------------------------

export const unstable_getInternalStates = (): {
export function unstable_getInternalStates(): {
proxyStateMap: typeof proxyStateMap
refSet: typeof refSet
snapCache: typeof snapCache
versionHolder: typeof versionHolder
proxyCache: typeof proxyCache
} => ({
proxyStateMap,
refSet,
snapCache,
versionHolder,
proxyCache,
})
} {
return {
proxyStateMap,
refSet,
snapCache,
versionHolder,
proxyCache,
}
}

export function unstable_replaceInternalFunction(
name: 'objectIs',
Expand Down
4 changes: 2 additions & 2 deletions src/vanilla/utils/deepClone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const getDefaultRefSet = (): WeakSet<object> => {
return defaultRefSet
}

export const deepClone = <T>(
export function deepClone<T>(
obj: T,
getRefSet: () => WeakSet<object> = getDefaultRefSet,
): T => {
): T {
if (!isObject(obj) || getRefSet().has(obj)) {
return obj
}
Expand Down