feat: add legacy beta map compatibility interfaces#27240
feat: add legacy beta map compatibility interfaces#27240jenn-le wants to merge 1 commit intomicrosoft:mainfrom
Conversation
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (218 lines, 10 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
Pull request overview
Adds new legacy/beta “Map-compatible” typing surfaces so legacy DDS APIs can align with JavaScript Map signatures while still participating in Fluid’s stable FluidMap abstraction shape.
Changes:
- Introduces
FluidMapLegacy<K, V>in@fluidframework/core-interfaces(legacy/beta) to preserveMap-style mutator returns (delete(): boolean,set(): this) andclear(). - Adds
IDirectoryBetaandISharedMapBeta(legacy/beta) that replace the built-inMapinheritance withFluidMapLegacyviaOmit<..., keyof Map<...>>. - Adds compile-time type tests and updates API reports + changeset to validate/ship the new legacy surfaces.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/dds/map/src/test/types/fluidMapLegacyTypes.ts | Adds type-level assertions validating *Beta assignability to FluidMapLegacy and Map. |
| packages/dds/map/src/interfaces.ts | Introduces IDirectoryBeta / ISharedMapBeta using FluidMapLegacy for map-like API shape. |
| packages/dds/map/src/index.ts | Re-exports the new beta interfaces from the package surface (gated by @legacy @beta tags). |
| packages/dds/map/api-report/map.legacy.beta.api.md | Updates legacy beta API report to include the new beta interfaces. |
| packages/common/core-interfaces/src/test/types/fluidMapTypes.ts | Adds type-level assertions for FluidMapLegacy compatibility with FluidMap and Map. |
| packages/common/core-interfaces/src/index.ts | Exports FluidMapLegacy from the package index (release-tag filtered into legacy typings). |
| packages/common/core-interfaces/src/fluidMap.ts | Defines FluidMapLegacy<K, V> (legacy/beta) extending FluidMap with Map-style mutators. |
| packages/common/core-interfaces/api-report/core-interfaces.legacy.beta.api.md | Updates legacy beta API report to include FluidMapLegacy. |
| packages/common/core-interfaces/api-report/core-interfaces.legacy.alpha.api.md | Updates legacy alpha API report to include FluidMapLegacy (alpha rollup includes beta surfaces). |
| .changeset/lazy-lies-enjoy.md | Adds changeset bumping @fluidframework/core-interfaces and @fluidframework/map for the new legacy/beta types. |
| IEventProvider, | ||
| IEventThisPlaceHolder, | ||
| } from "@fluidframework/core-interfaces"; | ||
| // eslint-disable-next-line import-x/no-internal-modules |
There was a problem hiding this comment.
Is there a proper way to use beta APIs here?
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
| export interface IDirectoryBeta | ||
| // TODO: Use `unknown` instead (breaking change). | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| extends Omit<IDirectory, keyof Map<string, any>>, |
There was a problem hiding this comment.
I think it would be cleaner to exclude "get" and "set" from the keys of map you are filtering out rather than restating them below.
| type requireTrue<_X extends true> = true; | ||
| type isAssignableTo<Source, Destination> = [Source] extends [Destination] ? true : false; |
There was a problem hiding this comment.
For the use cases in this file, I think requireAssignableTo (which you can import from build-tools) is a better fit. Does basically the same thing in one step, and gives better error messages when it fails than this approach.
Description
Adds legacy beta map compatibility interfaces for APIs that need to align with JavaScript
Mapwhile still using Fluid's map abstraction.This change introduces
FluidMapLegacyin@fluidframework/core-interfaces/legacy. It extendsFluidMapand only adds the legacy/built-inMap-style members needed for compatibility:clear,deletereturningboolean,setreturningthis, and aforEachcallback typed withFluidMapLegacy.This also adds
IDirectoryBetaandISharedMapBetain@fluidframework/map/legacy. The existingIDirectoryandISharedMapinterfaces are unchanged and continue to extend the built-inMap; the new beta variants provide an opt-in shape that consumesFluidMapLegacy.