aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-01-14 11:27:51 +0530
committerAkshay Nair <phenax5@gmail.com>2023-01-14 11:27:51 +0530
commitb347afc70c305b47860a40bac43c3fe407a3c25a (patch)
treef8bdf2ab6bbd070e6cf1fae8b16a25c268c765ad /src
parent97817711d3eebaacc354a77aa83bc9544cc87d42 (diff)
downloadts-types-lang-b347afc70c305b47860a40bac43c3fe407a3c25a.tar.gz
ts-types-lang-b347afc70c305b47860a40bac43c3fe407a3c25a.zip
chore: prettier
Diffstat (limited to 'src')
-rw-r--r--src/context.ts4
-rw-r--r--src/eval-env/builtins.ts15
-rw-r--r--src/types.ts12
3 files changed, 19 insertions, 12 deletions
diff --git a/src/context.ts b/src/context.ts
index adc0be5..fe33731 100644
--- a/src/context.ts
+++ b/src/context.ts
@@ -116,7 +116,7 @@ export const createContext = (options: CtxOptions): Ctx => {
evaluateType,
newScope() {
- environment.unshift(new Map)
+ environment.unshift(new Map())
},
addToScope(name, resKey) {
if (environment.length === 0) ctx.newScope()
@@ -127,7 +127,7 @@ export const createContext = (options: CtxOptions): Ctx => {
environment.shift()
},
getKeyInScope(name) {
- return environment.find(scope => scope.has(name))?.get(name)
+ return environment.find((scope) => scope.has(name))?.get(name)
},
withScope: (fn) => async () => {
ctx.newScope()
diff --git a/src/eval-env/builtins.ts b/src/eval-env/builtins.ts
index 1ded638..669a005 100644
--- a/src/eval-env/builtins.ts
+++ b/src/eval-env/builtins.ts
@@ -4,7 +4,9 @@ import { evalList } from '../util'
const applyFunc = (ctx: Ctx, fn: Type | undefined, val: string): Type => {
const resultType = (() => {
- const baseTypes = fn?.getBaseTypes().flatMap(t => t.getSymbol()?.getName())
+ const baseTypes = fn
+ ?.getBaseTypes()
+ .flatMap((t) => t.getSymbol()?.getName())
if (baseTypes?.includes('Kind1')) {
const [_, resultNode] = ctx.createResult(
@@ -15,7 +17,9 @@ const applyFunc = (ctx: Ctx, fn: Type | undefined, val: string): Type => {
.getProperty('output')
?.getTypeAtLocation(resultNode)
} else {
- const [_key, resultNode] = ctx.createResult(`ReturnType<${ctx.typeToString(fn)}>`)
+ const [_key, resultNode] = ctx.createResult(
+ `ReturnType<${ctx.typeToString(fn)}>`
+ )
const resValueNode = resultNode
?.asKind(SyntaxKind.PropertySignature)
@@ -129,8 +133,11 @@ export default (ctx: Ctx, args: Type[]) => ({
// TODO: Handle resultKey undefined case
- const resultType =
- applyFunc(ctx, chainToKind, `(${ctx.getResultExpr(resultKey)})['output']`)
+ const resultType = applyFunc(
+ ctx,
+ chainToKind,
+ `(${ctx.getResultExpr(resultKey)})['output']`
+ )
return ctx.evaluateType(ctx, resultType)
}),
diff --git a/src/types.ts b/src/types.ts
index 411c8ed..6ea282e 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -29,11 +29,11 @@ export interface Ctx {
runCustomEffect: (name: string, args: Type[]) => Promise<string[]>
hasCustomEffect: (name: string) => boolean
- evaluateType: (ctx: Ctx, effTyp: Type) => Promise<string[]>,
+ evaluateType: (ctx: Ctx, effTyp: Type) => Promise<string[]>
- withScope: (fn: () => Promise<string[]>) => (() => Promise<string[]>),
- newScope: () => void,
- clearScope: () => void,
- addToScope: (name: string, resKey: string) => void,
- getKeyInScope: (name: string) => string | undefined,
+ withScope: (fn: () => Promise<string[]>) => () => Promise<string[]>
+ newScope: () => void
+ clearScope: () => void
+ addToScope: (name: string, resKey: string) => void
+ getKeyInScope: (name: string) => string | undefined
}