From d87c171a59a1293aa223d98fc19d4e5a694516c3 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 12 Jan 2023 00:30:17 +0530 Subject: fix: minor fixes --- src/context.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/context.ts') 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 = { -- cgit v1.3.1