Skip to content

Commit 1ca51fe

Browse files
committed
Documented one of the creepy casts.
1 parent 50f85f1 commit 1ca51fe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/dds/shared-object-base/src/sharedObjectKernel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ class SharedObjectFromKernel<
142142
logger: this.logger,
143143
idCompressor: runtime.idCompressor,
144144
lastSequenceNumber: () => this.deltaManager.lastSequenceNumber,
145+
146+
// This cast is needed since IFluidDataStoreRuntimeInternalConfig does not extend IFluidDataStoreRuntime directly. This pattern
147+
// allows us to avoid breaking changes to IFluidDataStoreRuntime by hiding internal members in a separate interface, but comes
148+
// at the cost of less compile-time enforcement. For example, if the runtime did not implement `minVersionForCollab` and the
149+
// member was still optional (e.g., during the deprecation window where backwards-compatibility is maintained), the compiler
150+
// would emit an error.
145151
minVersionForCollab: (runtime as IFluidDataStoreRuntimeInternalConfig)
146152
.minVersionForCollab,
147153
};

0 commit comments

Comments
 (0)