diff --git a/app/gui2/.prettierignore b/app/gui2/.prettierignore index 766e0a799a36..bb6b39b75420 100644 --- a/app/gui2/.prettierignore +++ b/app/gui2/.prettierignore @@ -1,2 +1,4 @@ *.html -*.css \ No newline at end of file +*.css + +**/generated diff --git a/app/gui2/parser-codegen/src/codegen.ts b/app/gui2/parser-codegen/src/codegen.ts index 16ec205a87bd..e00ac7ccffcf 100644 --- a/app/gui2/parser-codegen/src/codegen.ts +++ b/app/gui2/parser-codegen/src/codegen.ts @@ -2,12 +2,18 @@ import * as fs from 'fs' import * as ts from 'typescript' import { factory as tsf } from 'typescript' +type DiscriminantMap = { + [discriminant: number]: string +} +type TypeGraph = { + [id: string]: Schema.Type +} module Schema { export type Type = { name: string fields: [string, Field][] parent: string | null - discriminants: [number: string] + discriminants: DiscriminantMap size: number } export type Field = { @@ -22,9 +28,6 @@ module Schema { export type Result = { class: 'result'; type0: TypeRef; type1: TypeRef } export type PrimitiveType = 'bool' | 'u32' | 'u64' | 'i32' | 'i64' | 'char' | 'string' } -type TypeGraph = { - [id: string]: Schema.Type -} type Schema = { types: TypeGraph } @@ -204,7 +207,6 @@ class Type { switch (c) { case 'type': const ty = types[ref.id] - const parentId = ty.parent const parent = ty.parent != null ? types[ty.parent] : null const typeName = namespacedName(ty.name, parent?.name) const type = tsf.createTypeReferenceNode(typeName) @@ -377,7 +379,7 @@ function makeDebugFunction(fields: [string, Schema.Field][]): ts.MethodDeclarati [], ), ), - ...fields.map(([name, field]: [string, Schema.Field]) => + ...fields.map(([name, _field]: [string, Schema.Field]) => tsf.createPropertyAssignment(getterIdent(name), debugValue(getterIdent(name))), ), ]), diff --git a/app/gui2/parser-codegen/tsconfig.json b/app/gui2/parser-codegen/tsconfig.json index 8b3d6f6d979f..8bc485587375 100644 --- a/app/gui2/parser-codegen/tsconfig.json +++ b/app/gui2/parser-codegen/tsconfig.json @@ -1,12 +1,7 @@ { "extends": "@tsconfig/node18/tsconfig.json", "compilerOptions": { - "module": "commonjs", - "moduleResolution": "node", - "esModuleInterop": true, - "target": "es6", "sourceMap": true, "outDir": "dist" }, - "lib": ["es2015"], }