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

Replace any with unknown and fix an any->void return type in the shared-object-base package #23236

Open
alexvy86 opened this issue Dec 3, 2024 · 0 comments
Assignees
Labels
api deprecation Changes to a deprecated API triage

Comments

@alexvy86
Copy link
Contributor

alexvy86 commented Dec 3, 2024

Affected APIs

any -> unknown

  • IFluidSerializer.encode(...) now takes value: unknown instead of value: any and returns unknown instead of any.
  • IFluidSerializer.decode(...) now takes input: unknown instead of input: any and returns unknown instead of any.
  • IFluidSerializer.stringify(...) now takes value: unknown instead of value: any.
  • IFluidSerializer.parse(...) now returns unknown instead of any.
  • SharedObjectCore.applyStashedOps(...) now takes content: unknown instead of content: any.
  • SharedObjectCore.rollback(...) now takes content: unknown instead of content: any.
  • SharedObjectCore.submitLocalMessage(...) now takes content: unknown instead of content: any.
  • SharedObjectCore.reSubmitCore(...) now takes content: unknown instead of content: any.
  • In SharedObjectCore.newAckBasedPromise<T>(...) the executor parameter now takes reject: (reason?: unknown) instead of reject: (reason?: any).
  • makeHandlesSerializable(...) now returns unknown instead of any.
  • parseHandles(...) now returns unknown instead of any.

any -> void

  • SharedObjectCore.processCore(...) now returns void instead of any.
  • SharedObjectCore.onDisconnect(...) now returns void instead of any.

Context

To improve type safety of the Fluid Framework API surface, we're moving away from using the any type in favor of unknown. This issue tracks such updates for the API surface of the @fliuidframework/shared-object-base package.

Approach

We're replacing any instances of the any type in the API surface with unknown.

PR: #23238 and test/ branch

Two exceptions are where the correct return type is void instead of any.

Dependencies

N/A

Compatibility Concerns

Consumer of Fluid using the affected APIs might need to update their code to do additional validations or type casts.

Phases

From Fluid's side, updating the types is the only step left. For consumers, potential work will come when they consume this change.

Open Questions

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api deprecation Changes to a deprecated API triage
Projects
None yet
Development

No branches or pull requests

1 participant