From d597a50c6670b1bee689e00a6b8ac90d23b320dc Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 21 May 2021 18:53:50 +0200 Subject: [PATCH] core-api: add global definition of Symbol.observable Signed-off-by: Patrik Oldsberg --- .changeset/old-pigs-happen.md | 5 +++++ packages/core-api/src/types.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/old-pigs-happen.md diff --git a/.changeset/old-pigs-happen.md b/.changeset/old-pigs-happen.md new file mode 100644 index 0000000000..2af5969966 --- /dev/null +++ b/.changeset/old-pigs-happen.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-api': patch +--- + +Add a global type definition for `Symbol.observable`, fix type checking in projects that didn't already have it defined. diff --git a/packages/core-api/src/types.ts b/packages/core-api/src/types.ts index 8782280be0..ab0aa56a1b 100644 --- a/packages/core-api/src/types.ts +++ b/packages/core-api/src/types.ts @@ -42,6 +42,14 @@ export type Subscription = { readonly closed: boolean; }; +// Declares the global well-known Symbol.observable +// We get the actual runtime polyfill from zen-observable +declare global { + interface SymbolConstructor { + readonly observable: symbol; + } +} + /** * Observable sequence of values and errors, see TC39. *