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

TS namespace #10

Closed
myalban opened this issue Jul 15, 2021 · 4 comments
Closed

TS namespace #10

myalban opened this issue Jul 15, 2021 · 4 comments
Labels

Comments

@myalban
Copy link

myalban commented Jul 15, 2021

Hi,

It seems there is no namespace support for typeconv
Example, this file sample.ts output nothing
export namespace ModelVersion { export interface Version { version: string; codename: string; id: string; } }
Best regards

@grantila
Copy link
Owner

Hmm, the transformations goes through core-types and eventually into JSON Schema, OpenAPI or GraphQL, neither of which have namespaces.

What is the expected result here? To simply extract interfaces from the namespace and ignore the namespace in the output, or mangle the names somehow into e.g. ModelVersion_Version or ModelVersionVersion?

@eastcoastcoder
Copy link

eastcoastcoder commented Mar 10, 2022

It would be perfect for me if we could just ignore these namespaces completely (as in, don't skip the interfaces but no need to include the namespace in the output), or at least have that as a option.

const { data: doc } = convertTypeScriptToCoreTypes(tsFile, {
  namespace: 'ignore',
});

@gerbal
Copy link

gerbal commented Jan 30, 2023

I've opened a PR (core-types-ts#10) to add basic namespace handling. Since my target use case needs namespaces to differentiate identically named interfaces, I've elected to format namespaces like ModelVersion.Version, which works well with OAPI as the output target.

grantila added a commit that referenced this issue Feb 5, 2023
Introduces --ts-namespaces option

fix #10
grantila added a commit that referenced this issue Feb 5, 2023
Introduces --ts-namespaces option

fix #10
@github-actions
Copy link

github-actions bot commented Feb 5, 2023

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants