add feature to generate output without namespace
abenhamdine opened this issue · comments
Currently, namespace parameter is required.
If one runs schemats without argument -n (or with empty one) like that :
schemats generate -c postgres://postgres@localhost/osm -t users -o osm.ts
It ends up with the following output in osm.ts :
export namespace undefined {
export namespace usersFields {
...
Using a namespace for a whole module in typescript is ok, but a bit outdated.
With es2015 modules, it seems preferable to generate directly :
export namespace usersFields {
...
wich allows to import as following :
import * as myNamespaceInConsumerModule from 'osm.ts'
...
It would be nice to make namespace optional.
You are right.
I'm think about deprecating the namespace parameter all together. The choice of having a namespace was due to my inexperience with Typescript earlier, and mixed information from Typescript 1.5 days. As of today, and using Typescript 2.0, there's really no motivation to keep using namespaces
Totally agree 👍