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: use "import type" in the Typescript SDK #623

Merged
merged 1 commit into from
Apr 22, 2021
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
22 changes: 13 additions & 9 deletions packages/sdk-codegen/src/typescript.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -127,15 +128,16 @@ 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()}
*
*/

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
Expand All @@ -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} {

Expand All @@ -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}'
Expand Down
9 changes: 4 additions & 5 deletions packages/sdk/src/3.1/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@
* 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
*
*/

import { sdkVersion } from '../constants'
import {
import type {
IAccessToken,
IApiSession,
IApiVersion,
Expand Down
9 changes: 4 additions & 5 deletions packages/sdk/src/3.1/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/3.1/methodsInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* 375 API methods
*/

import {
import type {
DelimArray,
IDictionary,
ITransportSettings,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/3.1/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 4 additions & 5 deletions packages/sdk/src/4.0/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@
* 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
*
*/

import { sdkVersion } from '../constants'
import {
import type {
IAccessToken,
IApiSession,
IApiVersion,
Expand Down
9 changes: 4 additions & 5 deletions packages/sdk/src/4.0/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/4.0/methodsInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* 408 API methods
*/

import {
import type {
DelimArray,
IDictionary,
ITransportSettings,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/4.0/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down