Description
Hi,
I have used this tool to generate a package.json
type description, starting from the official JSON schema.
The generated output file is almost correct, but it requires few manual fixes.
So here I report the issues I have found, to allow to improve the tool.
1 Linter
Yes, this is not a bug, but since tslint is deprecated since a lot of time, it could be nice to replace:
/* tslint:disable */
with:
/* eslint-disable */
2 Error in compiling
There are some places where something as this is generated:
{
"."?: PackageExportsEntry | PackageExportsFallback;
[k: string]: PackageExportsEntry | PackageExportsFallback;
}
And it fails to compile:
Property '"."' of type 'PackageExportsEntry | PackageExportsFallback | undefined'
is not assignable to 'string' index type 'PackageExportsEntry | PackageExportsFallback'.
15443 "."?: PackageExportsEntry | PackageExportsFallback;
The error is that the field "."
is optional (it is declared with ?:
, but also an "or" with undefined would result in the same error),
and its type is the same of the "index type" ([k: string]: PackageExportsEntry | PackageExportsFallback;
), except that the index type is not optional.
So the fix is to make also the index type optional:
{
"."?: PackageExportsEntry | PackageExportsFallback;
[k: string]: PackageExportsEntry | PackageExportsFallback | undefined;
}
Regards