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

fix: better default exports in src/index.ts #120

Merged
merged 3 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions templates/typescript_gapic/src/index.ts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ limitations under the License.
{% import "../_license.njk" as license -%}
{{license.license()}}
import * as {{ api.naming.version }} from './{{ api.naming.version }}';
export {{ '{' + api.naming.version + '}' }};
{% for service in api.services -%}
{%- for service in api.services %}
const {{ service.name.toPascalCase() }}Client = {{ api.naming.version }}.{{ service.name.toPascalCase() }}Client;
export {{ '{' + service.name.toPascalCase() + 'Client' + '}' }};
{%- endfor %}
export { {{- api.naming.version }}
{%- for service in api.services -%}
, {{ service.name.toPascalCase() + 'Client' }}
{%- endfor -%}
};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
export default { {{- api.naming.version }}
{%- for service in api.services -%}
, {{ service.name.toPascalCase() + 'Client' }}
{%- endfor -%}
};
6 changes: 4 additions & 2 deletions typescript/test/testdata/keymanager/src/index.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// ** All changes to this file may be overwritten. **

import * as v1 from './v1';
export {v1};
const KeyManagementServiceClient = v1.KeyManagementServiceClient;
export {KeyManagementServiceClient};
export {v1, KeyManagementServiceClient};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
export default {v1, KeyManagementServiceClient};
6 changes: 4 additions & 2 deletions typescript/test/testdata/showcase/src/index.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// ** All changes to this file may be overwritten. **

import * as v1beta1 from './v1beta1';
export {v1beta1};
const EchoClient = v1beta1.EchoClient;
export {EchoClient};
export {v1beta1, EchoClient};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
export default {v1beta1, EchoClient};
6 changes: 4 additions & 2 deletions typescript/test/testdata/texttospeech/src/index.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// ** All changes to this file may be overwritten. **

import * as v1 from './v1';
export {v1};
const TextToSpeechClient = v1.TextToSpeechClient;
export {TextToSpeechClient};
export {v1, TextToSpeechClient};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
export default {v1, TextToSpeechClient};
6 changes: 4 additions & 2 deletions typescript/test/testdata/translate/src/index.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// ** All changes to this file may be overwritten. **

import * as v3beta1 from './v3beta1';
export {v3beta1};
const TranslationServiceClient = v3beta1.TranslationServiceClient;
export {TranslationServiceClient};
export {v3beta1, TranslationServiceClient};
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
export default {v3beta1, TranslationServiceClient};