Skip to content

Commit

Permalink
e📝 Some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis committed Jan 26, 2024
1 parent 6b10c4d commit c35fe85
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/tasks/src/scripts/inference-codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ async function generateTypescript(inputData: InputData): Promise<SerializedRende
},
});
}
/**
* quicktype is unable to generate "top-level array types" that are defined in the output spec: https://github.com/glideapps/quicktype/issues/2481
* We have to use the TypeScript API to generate those types when required.
* This hacky function:
* - looks for the generated interface for output types
* - renames it with a `Element` suffix
* - generates type alias in the form `export type <OutputType> = <OutputType>Element[];
*
* And writes that to the `inference.ts` file
*
*/

async function postProcessOutput(path2generated: string, outputSpec: Record<string, unknown>): Promise<void> {
const source = ts.createSourceFile(
Expand Down

0 comments on commit c35fe85

Please sign in to comment.