Closed gCardinal closed 2 years ago
I am seeing this too, using the following command
typeconv --from-type ts --to-type st -o suretype ./interfaces.ts
with typeconv 1.7.0
ah, but only when typeconv
was installed globally! When I used typeconv installed locally to my package.json, this error did not reproduce
I'm seeing the same, regardless of the installed location.
Running as:
node_modules/.bin/typeconv --from-type=oapi --to-type=st --output-directory=src/ foo.json
Same issue here, just doing string replacement for now to clean it up but would be nice to get this fixed.
Quick patch here incase this is blocking you
core-types-suretype+1.4.1.patch
diff --git a/node_modules/core-types-suretype/dist/lib/json-schema-to-suretype.js b/node_modules/core-types-suretype/dist/lib/json-schema-to-suretype.js
index c0d064d..5d9a249 100644
--- a/node_modules/core-types-suretype/dist/lib/json-schema-to-suretype.js
+++ b/node_modules/core-types-suretype/dist/lib/json-schema-to-suretype.js
@@ -158,7 +158,7 @@ function createImportHeader(regular, raw, compile, TypeOf, annotate) {
...(annotate ? ['annotate'] : []),
...(TypeOf ? ['TypeOf'] : []),
]
- .map(name => helpers_1.factory.createImportSpecifier(undefined, helpers_1.t.ident(name)));
+ .map(name => helpers_1.factory.createImportSpecifier(undefined, undefined, helpers_1.t.ident(name)));
return helpers_1.factory.createImportDeclaration(undefined, // decorators
undefined, // modifiers
helpers_1.factory.createImportClause(false, undefined, helpers_1.factory.createNamedImports(importedMembers)), helpers_1.factory.createStringLiteral('suretype', true));
Fixed in 1.8. This was caused by TypeScript breaking the API/ABI in a minor version, so having TypeScript > 4.5 installed in the same repo broke this. Now depending on 4.7.
Running a simple conversion from json-schema to suretype results in imports from suretype that are unusable. See below:
Generation was done in the most basic way possible I believe: