diff --git a/src/context/context.ts b/src/context/context.ts index c85323f39..2619be6b6 100644 --- a/src/context/context.ts +++ b/src/context/context.ts @@ -95,7 +95,7 @@ export class Context { return scope } public push (ctx: Scope): Scope { - const scope = ctx instanceof Drop ? ctx : createScope(ctx) + const scope = createScope(ctx) this.scopes.push(scope) return scope } diff --git a/src/context/scope.ts b/src/context/scope.ts index e5fd79943..33603d941 100644 --- a/src/context/scope.ts +++ b/src/context/scope.ts @@ -6,6 +6,7 @@ export interface ScopeObject extends Record { export type Scope = ScopeObject | Drop -export function createScope (from?: ScopeObject): ScopeObject { +export function createScope (from?: Scope): Scope { + if (from instanceof Drop) return from return Object.assign(Object.create(null), from) }