From 109a33071c9544cab158ade8c9c068a3bac2f1a7 Mon Sep 17 00:00:00 2001 From: Guy Carmeli Date: Fri, 20 Dec 2024 09:38:35 +0200 Subject: [PATCH] Update scope type to accept custom scopes --- .../react-obsidian/src/decorators/LifecycleBound.ts | 2 +- .../customScopedLifecycleBoundGraphs.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 packages/react-obsidian/test/integration/customScopedLifecycleBoundGraphs.test.ts diff --git a/packages/react-obsidian/src/decorators/LifecycleBound.ts b/packages/react-obsidian/src/decorators/LifecycleBound.ts index 9a720e29..4d3f25c7 100644 --- a/packages/react-obsidian/src/decorators/LifecycleBound.ts +++ b/packages/react-obsidian/src/decorators/LifecycleBound.ts @@ -1,5 +1,5 @@ type Options = { - scope?: 'component' | 'feature'; + scope?: 'component' | 'feature' | (string & {}); }; export function LifecycleBound(options?: Options) { diff --git a/packages/react-obsidian/test/integration/customScopedLifecycleBoundGraphs.test.ts b/packages/react-obsidian/test/integration/customScopedLifecycleBoundGraphs.test.ts new file mode 100644 index 00000000..358b5ed5 --- /dev/null +++ b/packages/react-obsidian/test/integration/customScopedLifecycleBoundGraphs.test.ts @@ -0,0 +1,10 @@ +/* eslint-disable unused-imports/no-unused-vars */ +import { LifecycleBound, ObjectGraph } from 'src'; + +describe('custom scoped lifecycle-bound graphs', () => { + it('should be able to use a custom scoped lifecycle-bound graph', () => { + @LifecycleBound({scope: 'customScope'}) + class Temp extends ObjectGraph { + } + }); +});