Skip to content

Commit

Permalink
docs: renamed returnValue to returnType for TS gen (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaster authored Apr 14, 2021
1 parent 8b7f2f0 commit 53a32eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"test:ts": "yarn jest --reporters=default --reporters=jest-junit",
"test:apix": "yarn jest packages/api-explorer packages/run-it packages/extension-api-explorer",
"test:iphone": "xcodebuild test -project swift/looker/looker.xcodeproj -scheme looker-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.4.1' | xcpretty --test --color",
"test:gen": "yarn jest packages/sdk-codegen",
"test:sdk": "yarn jest packages/sdk",
"test:jest": "DOT_ENV_FILE=.env.test jest",
"test:ext": "yarn jest packages/extension-sdk packages/extension-sdk-react",
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk-codegen/src/typescript.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class ${this.packageName}Stream extends APIMethods {
this.commentHeader(indent, headComment) +
`${indent}async ${method.name}(` +
(streamer ? `\n${bump}${callback}` : '')
const returns = streamer ? '' : `: ${this.returnValue(indent, method)}`
const returns = streamer ? '' : `: ${this.returnType(indent, method)}`

return (
header +
Expand Down Expand Up @@ -365,7 +365,12 @@ export class ${this.packageName}Stream extends APIMethods {
)
}

returnValue(indent: string, method: IMethod): string {
/**
* Return type declaration for the method
* @param indent
* @param method
*/
returnType(indent: string, method: IMethod): string {
const mapped = this.typeMap(method.type)
const errors = this.errorResponses(indent, method)
return `Promise<SDKResponse<${mapped.name}, ${errors}>>`
Expand Down Expand Up @@ -407,7 +412,7 @@ export class ${this.packageName}Stream extends APIMethods {
const header =
this.commentHeader(indent, headComment) +
`${indent}export const ${method.name} = async (`
const returns = this.returnValue(indent, method)
const returns = this.returnType(indent, method)

return (
header +
Expand Down

0 comments on commit 53a32eb

Please sign in to comment.