typeconv icon indicating copy to clipboard operation
typeconv copied to clipboard

TS namespace

Open myalban opened this issue 4 years ago • 2 comments

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

myalban avatar Jul 15 '21 12:07 myalban

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?

grantila avatar Oct 17 '21 22:10 grantila

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',
});

eastcoastcoder avatar Mar 10 '22 22:03 eastcoastcoder

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.

gerbal avatar Jan 30 '23 16:01 gerbal

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Feb 05 '23 10:02 github-actions[bot]