diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-01-12 00:30:17 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-01-12 00:30:17 +0530 |
| commit | d87c171a59a1293aa223d98fc19d4e5a694516c3 (patch) | |
| tree | d0f4af920a573e9395751ba03ee6566ee2cd1f47 | |
| parent | 49d6379c3d40b684b28f4a957ff1ffb81a2560ee (diff) | |
| download | ts-types-lang-d87c171a59a1293aa223d98fc19d4e5a694516c3.tar.gz ts-types-lang-d87c171a59a1293aa223d98fc19d4e5a694516c3.zip | |
fix: minor fixes
Diffstat (limited to '')
| -rw-r--r-- | src/context.ts | 12 | ||||
| -rw-r--r-- | src/eval.ts | 4 | ||||
| -rw-r--r-- | tsconfig.json | 1 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/context.ts b/src/context.ts index 14b5115..bdae0d3 100644 --- a/src/context.ts +++ b/src/context.ts @@ -12,7 +12,11 @@ export interface CtxOptions { export const createContext = (options: CtxOptions): Ctx => { const project = new Project({ compilerOptions: { - target: ScriptTarget.ES3, + target: ScriptTarget.ESNext, + strict: true, + alwaysStrict: true, + disableSizeLimit: true, + isolatedModules: true, }, }) @@ -27,7 +31,7 @@ export const createContext = (options: CtxOptions): Ctx => { } const typeToString = (ty: Type | undefined): string => - ty ? typeChecker.compilerObject.typeToString(ty.compilerType) : '' + ty ? typeChecker.getTypeText(ty) : '' const [resultTypeNode] = sourceFile.addStatements( `type ${RESULT_TYPE_NAME} = {}` @@ -56,7 +60,9 @@ export const createContext = (options: CtxOptions): Ctx => { const getTypeValue = (ty: Type | undefined): any => { try { return JSON.parse(typeToString(ty)) - } catch(_) { return } + } catch(_) { + return null + } } const ctx: Ctx = { diff --git a/src/eval.ts b/src/eval.ts index 8c8940f..19a5557 100644 --- a/src/eval.ts +++ b/src/eval.ts @@ -23,9 +23,11 @@ export const evaluateType = async ( effTyp: Type ): Promise<string[]> => { const name = effTyp.getSymbol()?.getName() - const args = effTyp.getTypeArguments() + // console.log(ctx.typeToString(effTyp)) + // console.log(name, args.map(ctx.typeToString)) + return match(name, { DefineEffect: async () => { const [nameTyp, exprTyp] = args diff --git a/tsconfig.json b/tsconfig.json index 7c7eece..d8496d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,6 @@ "strictPropertyInitialization": true, "useUnknownInCatchVariables": true, "alwaysStrict": true, - "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitReturns": true, "noUncheckedIndexedAccess": true, |
