diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-13 19:40:15 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-13 19:59:56 +0530 |
| commit | 42f8c401dc9519bc8b2d386ce9eda072144a46d0 (patch) | |
| tree | e886538eccbd47beaaf27deff69267bd8c7dd67d /src/util.ts | |
| parent | 8ba316461d2dc0a1372af16836ce14ceabc2bf4f (diff) | |
| download | ts-types-lang-42f8c401dc9519bc8b2d386ce9eda072144a46d0.tar.gz ts-types-lang-42f8c401dc9519bc8b2d386ce9eda072144a46d0.zip | |
feat: refactors test runner
Diffstat (limited to '')
| -rw-r--r-- | src/util.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.ts b/src/util.ts index 136815e..13bdb35 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,4 +1,15 @@ +import { Type } from "ts-morph" +import { Ctx } from "./types" + export const match = <K extends string, R>( k: K | undefined, pattern: { [key in K | '_']: () => R } ) => (k && pattern[k] ? pattern[k]() : pattern._()) + +export const evalList = async (ctx: Ctx, effectTyps: Type[]) => { + const effectResults: string[] = [] + for (const item of effectTyps ?? []) { + effectResults.push(...(await ctx.evaluateType(ctx, item))) + } + return effectResults +} |
