tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

typecheck.py (1047B)


      1 import pathlib,json
      2 p=pathlib.Path.cwd(); rows=json.loads((p/'sources.json').read_text());paths={}
      3 for row in rows:
      4  entry=p/'deps'/row['slug']/row['entry'];paths[row['name']]=[str(entry.with_suffix('.d.ts') if entry.suffix=='.js' else entry)]
      5 (p/'deps'/'node-env.d.ts').write_text('declare const process: { env: { LOG?: string } };\n')
      6 # Declaration generation only; variance and class-field settings accommodate the
      7 # upstream source builds. Our application is checked separately with strict flags.
      8 config={'compilerOptions':{'target':'ES2022','module':'ESNext','moduleResolution':'Bundler','strict':True,'strictFunctionTypes':False,'strictNullChecks':True,'useDefineForClassFields':False,'skipLibCheck':True,'declaration':True,'emitDeclarationOnly':True,'rootDir':str(p/'deps'),'outDir':str(p/'types'),'lib':['ES2022','DOM','DOM.Iterable'],'paths':paths},'include':[str(p/'deps'/'codemirror-*'/'src'/'*.ts'),str(p/'deps'/'lezer-parser-*'/'src'/'*.ts'),str(p/'deps'/'node-env.d.ts')]}
      9 (p/'tsconfig.upstream.json').write_text(json.dumps(config))