From d50f6b0d5160c848a584b55045a38f0529c2a23f Mon Sep 17 00:00:00 2001 From: Matt Rakow Date: Fri, 5 Feb 2021 15:45:32 -0800 Subject: [PATCH] Explicitly export members of fluidRouter to workaround Typescript issue (#5056) When downstream customers augment the IRequestHeader, the [index: string]: any; signature is lost and they end up with "property does not exist" errors. This change uses this workaround to resolve the issue: microsoft/TypeScript#18877 (comment) --- packages/loader/core-interfaces/src/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/loader/core-interfaces/src/index.ts b/packages/loader/core-interfaces/src/index.ts index 38598c3c7a9e..6cb89ed148b6 100644 --- a/packages/loader/core-interfaces/src/index.ts +++ b/packages/loader/core-interfaces/src/index.ts @@ -8,7 +8,16 @@ export { IFluidObject } from "./fluidObject"; export * from "./fluidLoadable"; -export * from "./fluidRouter"; +// Typescript forgets the index signature when customers augment IRequestHeader if we export *. +// So we export the explicit members as a workaround: +// https://github.com/microsoft/TypeScript/issues/18877#issuecomment-476921038 +export { + IRequest, + IRequestHeader, + IResponse, + IProvideFluidRouter, + IFluidRouter, +} from "./fluidRouter"; export * from "./handles"; export * from "./serializer"; export * from "./fluidPackage";