aboutsummaryrefslogtreecommitdiff
path: root/src/context.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/context.ts')
-rw-r--r--src/context.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/context.ts b/src/context.ts
index fe33731..fab6653 100644
--- a/src/context.ts
+++ b/src/context.ts
@@ -56,6 +56,15 @@ export const createContext = (options: CtxOptions): Ctx => {
return [resultKey, node]
}
+ const removeResult = (key?: string) => {
+ if (!key) return
+ resultTypeNode
+ ?.asKind(SyntaxKind.TypeAliasDeclaration)
+ ?.getChildAtIndexIfKind(3, SyntaxKind.TypeLiteral)
+ ?.getProperty(key)
+ ?.remove()
+ }
+
const customEffects: Record<string, (args: Type[], ctx: Ctx) => any> = {}
const getTypeValue = (ty: Type | undefined): any => {
@@ -97,6 +106,7 @@ export const createContext = (options: CtxOptions): Ctx => {
createResult,
getResultExpr,
+ removeResult,
printResultNode: () => console.log(resultTypeNode?.print()),
addCustomEffect: (name, expr) => {