Description
My schema is pretty large, but I whittled it down to what's attached that seems to generate the issue.
My code is as follows:
import { compileFromFile } from 'json-schema-to-typescript';
...
const ts = await compileFromFile(file);
const name = path.basename(file, '.json');
await writeFile(`${outDir}/${name}.d.ts`, ts);
Where file is the .json file.
Attached is typescript-demo-parent.json
which is the input file that gets passed to compileFromFile
, and the resulting output typescript-demo-parent.d.ts
. In the output, results->matches is referenced as Matches1[]
. From the exports, Matches1
is a ScoredItem
, where as Matches
is Matches1 & Matches2
. Matches2
has the id
required property that is defined in the json file. From my point of view, results->matches should really be Matches[]
rather than Matches1[]
. When I enforce linting against this object in code, and try to set .id, it complains that it's not a valid property.
I uploaded the files with the .log
extension so github would accept me uploading them. Remove the extension to reproduce the issue.