From c7b5bf8135db37256b8b119240f1c5a6103dde63 Mon Sep 17 00:00:00 2001 From: John Kaster Date: Thu, 22 Apr 2021 16:14:27 -0700 Subject: [PATCH] chore: use "import type" in the Typescript SDK (#623) Change in codegen, and in the generated TS SDKs --- packages/sdk-codegen/src/typescript.gen.ts | 22 +++++++++++++--------- packages/sdk/src/3.1/funcs.ts | 9 ++++----- packages/sdk/src/3.1/methods.ts | 9 ++++----- packages/sdk/src/3.1/methodsInterface.ts | 4 ++-- packages/sdk/src/3.1/streams.ts | 8 ++++---- packages/sdk/src/4.0/funcs.ts | 9 ++++----- packages/sdk/src/4.0/methods.ts | 9 ++++----- packages/sdk/src/4.0/methodsInterface.ts | 4 ++-- packages/sdk/src/4.0/streams.ts | 8 ++++---- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/packages/sdk-codegen/src/typescript.gen.ts b/packages/sdk-codegen/src/typescript.gen.ts index e5415dee1..17af1bd26 100644 --- a/packages/sdk-codegen/src/typescript.gen.ts +++ b/packages/sdk-codegen/src/typescript.gen.ts @@ -100,14 +100,15 @@ export class TypescriptGen extends CodeGen { methodsPrologue(_indent: string) { return ` -import { ${this.rtlImports()}APIMethods, IAuthSession, ITransportSettings, encodeParam, SDKResponse } from '@looker/sdk-rtl' +import type { ${this.rtlImports()}IAuthSession, ITransportSettings, SDKResponse } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' /** * ${this.warnEditing()} * */ import { sdkVersion } from '../constants' -import { I${this.packageName} } from './methodsInterface' -import { ${this.typeNames().join(', ')} } from './models' +import type { I${this.packageName} } from './methodsInterface' +import type { ${this.typeNames().join(', ')} } from './models' export class ${this.packageName} extends APIMethods implements I${ this.packageName @@ -127,7 +128,8 @@ export class ${this.packageName} extends APIMethods implements I${ functionsPrologue(_indent: string) { return ` -import { ${this.rtlImports()}IAPIMethods, ITransportSettings, IAuthSession, encodeParam, SDKResponse, functionalSdk } from '@looker/sdk-rtl' +import type { ${this.rtlImports()}IAPIMethods, IAuthSession, ITransportSettings, SDKResponse } from '@looker/sdk-rtl' +import { encodeParam, functionalSdk } from '@looker/sdk-rtl' /** * ${this.warnEditing()} @@ -135,7 +137,7 @@ import { ${this.rtlImports()}IAPIMethods, ITransportSettings, IAuthSession, enco */ import { sdkVersion } from '../constants' -import { ${this.typeNames().join(', ')} } from './models' +import type { ${this.typeNames().join(', ')} } from './models' /** * Creates a "functional sdk" that knows the API and Looker release version @@ -152,12 +154,12 @@ export const functionalSdk${this.apiRef} = ( interfacesPrologue(_indent: string) { return ` -import { ${this.rtlImports()} ITransportSettings, SDKResponse } from '@looker/sdk-rtl' +import type { ${this.rtlImports()} ITransportSettings, SDKResponse } from '@looker/sdk-rtl' /** * ${this.warnEditing()} * */ -import { ${this.typeNames().join(', ')} } from './models' +import type { ${this.typeNames().join(', ')} } from './models' export interface I${this.packageName} { @@ -167,13 +169,15 @@ export interface I${this.packageName} { streamsPrologue(_indent: string): string { return ` import { Readable } from 'readable-stream' -import { ${this.rtlImports()}APIMethods, IAuthSession, ITransportSettings, encodeParam } from '@looker/sdk-rtl' +import type { ${this.rtlImports()}IAuthSession, ITransportSettings } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' + /** * ${this.warnEditing()} * */ import { sdkVersion } from '../constants' -import { ${this.typeNames().join(', ')} } from './models' +import type { ${this.typeNames().join(', ')} } from './models' export class ${this.packageName}Stream extends APIMethods { static readonly ApiVersion = '${this.apiVersion}' diff --git a/packages/sdk/src/3.1/funcs.ts b/packages/sdk/src/3.1/funcs.ts index a535880bb..06ab5e7e7 100644 --- a/packages/sdk/src/3.1/funcs.ts +++ b/packages/sdk/src/3.1/funcs.ts @@ -28,16 +28,15 @@ * 375 API methods */ -import { +import type { DelimArray, IDictionary, IAPIMethods, - ITransportSettings, IAuthSession, - encodeParam, + ITransportSettings, SDKResponse, - functionalSdk, } from '@looker/sdk-rtl' +import { encodeParam, functionalSdk } from '@looker/sdk-rtl' /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 3.1 @@ -45,7 +44,7 @@ import { */ import { sdkVersion } from '../constants' -import { +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/3.1/methods.ts b/packages/sdk/src/3.1/methods.ts index 16fe1506d..a5851dc4b 100644 --- a/packages/sdk/src/3.1/methods.ts +++ b/packages/sdk/src/3.1/methods.ts @@ -28,22 +28,21 @@ * 375 API methods */ -import { +import type { DelimArray, IDictionary, - APIMethods, IAuthSession, ITransportSettings, - encodeParam, SDKResponse, } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 3.1 * */ import { sdkVersion } from '../constants' -import { ILooker31SDK } from './methodsInterface' -import { +import type { ILooker31SDK } from './methodsInterface' +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/3.1/methodsInterface.ts b/packages/sdk/src/3.1/methodsInterface.ts index a57ef979a..39dad256f 100644 --- a/packages/sdk/src/3.1/methodsInterface.ts +++ b/packages/sdk/src/3.1/methodsInterface.ts @@ -28,7 +28,7 @@ * 375 API methods */ -import { +import type { DelimArray, IDictionary, ITransportSettings, @@ -38,7 +38,7 @@ import { * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 3.1 * */ -import { +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/3.1/streams.ts b/packages/sdk/src/3.1/streams.ts index c2fb26ef8..1ec37ed05 100644 --- a/packages/sdk/src/3.1/streams.ts +++ b/packages/sdk/src/3.1/streams.ts @@ -29,20 +29,20 @@ */ import { Readable } from 'readable-stream' -import { +import type { DelimArray, IDictionary, - APIMethods, IAuthSession, ITransportSettings, - encodeParam, } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' + /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 3.1 * */ import { sdkVersion } from '../constants' -import { +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/4.0/funcs.ts b/packages/sdk/src/4.0/funcs.ts index 3a9fde79a..5e11070e1 100644 --- a/packages/sdk/src/4.0/funcs.ts +++ b/packages/sdk/src/4.0/funcs.ts @@ -28,16 +28,15 @@ * 408 API methods */ -import { +import type { DelimArray, IDictionary, IAPIMethods, - ITransportSettings, IAuthSession, - encodeParam, + ITransportSettings, SDKResponse, - functionalSdk, } from '@looker/sdk-rtl' +import { encodeParam, functionalSdk } from '@looker/sdk-rtl' /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 4.0 @@ -45,7 +44,7 @@ import { */ import { sdkVersion } from '../constants' -import { +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/4.0/methods.ts b/packages/sdk/src/4.0/methods.ts index 3abac45a0..16b217b25 100644 --- a/packages/sdk/src/4.0/methods.ts +++ b/packages/sdk/src/4.0/methods.ts @@ -28,22 +28,21 @@ * 408 API methods */ -import { +import type { DelimArray, IDictionary, - APIMethods, IAuthSession, ITransportSettings, - encodeParam, SDKResponse, } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 4.0 * */ import { sdkVersion } from '../constants' -import { ILooker40SDK } from './methodsInterface' -import { +import type { ILooker40SDK } from './methodsInterface' +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/4.0/methodsInterface.ts b/packages/sdk/src/4.0/methodsInterface.ts index f7d741323..05c59b652 100644 --- a/packages/sdk/src/4.0/methodsInterface.ts +++ b/packages/sdk/src/4.0/methodsInterface.ts @@ -28,7 +28,7 @@ * 408 API methods */ -import { +import type { DelimArray, IDictionary, ITransportSettings, @@ -38,7 +38,7 @@ import { * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 4.0 * */ -import { +import type { IAccessToken, IApiSession, IApiVersion, diff --git a/packages/sdk/src/4.0/streams.ts b/packages/sdk/src/4.0/streams.ts index 13fe81318..23f6c0534 100644 --- a/packages/sdk/src/4.0/streams.ts +++ b/packages/sdk/src/4.0/streams.ts @@ -29,20 +29,20 @@ */ import { Readable } from 'readable-stream' -import { +import type { DelimArray, IDictionary, - APIMethods, IAuthSession, ITransportSettings, - encodeParam, } from '@looker/sdk-rtl' +import { APIMethods, encodeParam } from '@looker/sdk-rtl' + /** * NOTE: Do not edit this file generated by Looker SDK Codegen for Looker 21.4 API 4.0 * */ import { sdkVersion } from '../constants' -import { +import type { IAccessToken, IApiSession, IApiVersion,