buildo / metarpheus-io-ts

Generate domain models and client interpreting metarpheus output
MIT License
7 stars 1 forks source link

#98: missing Option and createOptionFromNullable imports in generated API file (closes #98) #99

Closed giogonzo closed 5 years ago

giogonzo commented 5 years ago

Closes [#2522334](https://buildo.kaiten.io/space/[object Object]/card/2522334)

⚠️ The line above was added during the automatic migration of all github project issues to Kaiten. The old GH issue link is kept here for reference (it is now deprecated, continue follow the original issue on Kaiten).

Closes #98

Since I'm just blindly hardcoding the imports in generated files, a project with no Option usage and noUnusedVariables: true in tsconfig would fail compiling :/

For newtypes we are adding the prelude conditionally in the model file only (btw, I think ti would fail in the same way if the definition of the newtype is inlined in Scala and doesn't have an explicit name?), but it is a bit trickier to correctly compute this condition for Option usages since the majority of usages is inlined in Scala and we'd need to keep track of wether an Option<T> has never been generated at any level deep in the tree.

Any ideas?

gabro commented 5 years ago

ts-ignore the import?