From 2c8aecedd55b0480fb4e123b6e07fa5b12953862 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 5 Nov 2020 09:38:54 -0800 Subject: [PATCH] fix: export clients as both const and type (#841) --- synthtool/gcp/templates/node_split_library/index.ts.j2 | 3 ++- tests/fixtures/node_templates/index_samples/sample_index.ts | 1 + tests/fixtures/node_templates/index_samples/src/index.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/synthtool/gcp/templates/node_split_library/index.ts.j2 b/synthtool/gcp/templates/node_split_library/index.ts.j2 index 906990004..f2d0b9276 100644 --- a/synthtool/gcp/templates/node_split_library/index.ts.j2 +++ b/synthtool/gcp/templates/node_split_library/index.ts.j2 @@ -17,7 +17,8 @@ // ** All changes to this file may be overwritten. ** {% for version in versions %}import * as {{ version }} from './{{ version}}';{{ "\n" }}{% endfor %} -{% for client in clients %}const {{ client }} = {{ default_version }}.{{ client }};{{ "\n" }}{% endfor %} +{% for client in clients %}const {{ client }} = {{ default_version }}.{{ client }}; +type {{ client }} = {{ default_version }}.{{ client }};{{ "\n" }}{% endfor %} export {{ "{" }}{{ versions|join(', ')}}, {{ clients|join(', ')}}{{ "}" }}; export default {{ "{" }}{{ versions|join(', ')}}, {{ clients|join(', ')}}{{ "}" }}; import * as protos from '../protos/protos'; diff --git a/tests/fixtures/node_templates/index_samples/sample_index.ts b/tests/fixtures/node_templates/index_samples/sample_index.ts index fa338b452..b280dd2e7 100644 --- a/tests/fixtures/node_templates/index_samples/sample_index.ts +++ b/tests/fixtures/node_templates/index_samples/sample_index.ts @@ -20,6 +20,7 @@ import * as v1 from './v1'; import * as v1beta1 from './v1beta1'; const TextToSpeechClient = v1.TextToSpeechClient; +type TextToSpeechClient = v1.TextToSpeechClient; export {v1, v1beta1, TextToSpeechClient}; export default {v1, v1beta1, TextToSpeechClient}; diff --git a/tests/fixtures/node_templates/index_samples/src/index.ts b/tests/fixtures/node_templates/index_samples/src/index.ts index fa338b452..b280dd2e7 100644 --- a/tests/fixtures/node_templates/index_samples/src/index.ts +++ b/tests/fixtures/node_templates/index_samples/src/index.ts @@ -20,6 +20,7 @@ import * as v1 from './v1'; import * as v1beta1 from './v1beta1'; const TextToSpeechClient = v1.TextToSpeechClient; +type TextToSpeechClient = v1.TextToSpeechClient; export {v1, v1beta1, TextToSpeechClient}; export default {v1, v1beta1, TextToSpeechClient};