Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feature to generate output without namespace #25

Closed
abenhamdine opened this issue Jan 6, 2017 · 3 comments
Closed

add feature to generate output without namespace #25

abenhamdine opened this issue Jan 6, 2017 · 3 comments
Assignees

Comments

@abenhamdine
Copy link
Contributor

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.

@abenhamdine abenhamdine changed the title add possibility to generate file without namespace add feature to generate output without namespace Jan 6, 2017
@xiamx
Copy link
Contributor

xiamx commented Jan 6, 2017

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

@abenhamdine
Copy link
Contributor Author

abenhamdine commented Jan 6, 2017

Totally agree 👍

@xiamx
Copy link
Contributor

xiamx commented Jan 16, 2017

Fixed by #32 64143dd

@xiamx xiamx closed this as completed Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants