From d8a969e231135978c4dd1fa67559101f506ad6f3 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Wed, 5 Nov 2025 01:20:07 -0800 Subject: recursion works for types with depth limit 5 --- src/lang/ts-lang/core/common.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/lang/ts-lang/core/common.ts') diff --git a/src/lang/ts-lang/core/common.ts b/src/lang/ts-lang/core/common.ts index fa5cb7c..95a9ad3 100644 --- a/src/lang/ts-lang/core/common.ts +++ b/src/lang/ts-lang/core/common.ts @@ -51,16 +51,20 @@ export type ParserCtx = { }; export type StackFrame< - Bindings extends Record = Record, - Parent extends StackFrame | null = any + Bindings extends Record = Record > = { bindings: Bindings; - parent: Parent; }; -export type EmptyStackFrame = StackFrame<{}, null>; +export type EmptyStackFrame = StackFrame<{}>; -export type WithPushedBindings< +export type MergeStackFrames< OldFrame extends StackFrame, - Bindings extends StackFrame["bindings"] -> = StackFrame; + NewFrame extends StackFrame +> = StackFrame<{ + [K in + | keyof OldFrame["bindings"] + | keyof NewFrame["bindings"]]: K extends keyof NewFrame["bindings"] + ? NewFrame["bindings"][K] + : OldFrame["bindings"][K]; +}>; -- cgit v1.2.3-70-g09d2