Skip to content

Commit f2c6567

Browse files
Fix build for ES2022 (#24323)
## Description If building client with ES2022, this fixes the only compile error. Since using ES2022 saves over 2% (7309 bytes) on bundle size (measured using SharedTree bundles which includes all of the runtime shared tree uses as well), making it easy to enable and experiment with seems like a good idea. Also building targeting ES2022 provides a better debug experience for JS private properties by not polyfilling them to weak map lookups.
1 parent 49e5be9 commit f2c6567

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/runtime/container-runtime/src/test/createChildDataStoreSync.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ describe("createChildDataStore", () => {
3131
};
3232
const testContext = class TestContext extends FluidDataStoreContext {
3333
protected pkg = ["ParentDataStore"];
34-
public registry: IFluidDataStoreRegistry | undefined;
34+
// This is a override of a protected property to expose it publicly, however TypeScript does not allow override to be used here to make this explicit.
35+
// This TypeScript issue is tracked by https://github.com/microsoft/TypeScript/issues/51515.
36+
// When targeting ES2022 or newer, TypeScript uses ESM properties here, which would overwrite the base property giving the error:
37+
// "Property 'registry' will overwrite the base property in 'FluidDataStoreContext'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.ts(2612)"
38+
// This is mitigated using `declare` to indicate that this property is only here for TypeScript typing reasons, and its declaration should have no effect at runtime.
39+
public declare registry: IFluidDataStoreRegistry | undefined;
3540
public getInitialSnapshotDetails = throwNYI;
3641
public setAttachState = throwNYI;
3742
public getAttachSummary = throwNYI;

0 commit comments

Comments
 (0)