Skip to content

Commit ce50c4f

Browse files
Strenghten the typings
1 parent ec3de10 commit ce50c4f

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

packages/cre-sdk/src/generated-sdk/capabilities/internal/nodeaction/v1/basicaction_sdk_gen.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ export class PerformActioner {
1818
) {}
1919
performAction<TInput>(input: CapabilityInput<TInput, NodeInputs, NodeInputsJson>): {
2020
result: () => NodeOutputs
21-
}
22-
performAction(input: NodeInputs | NodeInputsJson): { result: () => NodeOutputs } {
23-
// Cast to native overload signature - the impl dispatches on $typeName.
24-
return this.client.performAction(this.runtime, input as NodeInputs)
21+
} {
22+
return this.client.performAction<TInput>(this.runtime, input)
2523
}
2624
}
2725

packages/cre-sdk/src/generated-sdk/capabilities/networking/http/v1alpha/client_sdk_gen.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ export class SendRequester {
1818
) {}
1919
sendRequest<TInput>(input: CapabilityInput<TInput, Request, RequestJson>): {
2020
result: () => Response
21-
}
22-
sendRequest(input: Request | RequestJson): { result: () => Response } {
23-
// Cast to native overload signature - the impl dispatches on $typeName.
24-
return this.client.sendRequest(this.runtime, input as Request)
21+
} {
22+
return this.client.sendRequest<TInput>(this.runtime, input)
2523
}
2624
}
2725

packages/cre-sdk/src/generator/generate-sugar.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ export function generateActionSugarClass(
2222
return `
2323
export class ${sugarClassName} {
2424
constructor(private readonly runtime: NodeRuntime<unknown>, private readonly client: ${capabilityClassName}) {}
25-
${methodName}<TInput>(input: CapabilityInput<TInput, ${method.input.name}, ${method.input.name}Json>): {result: () => ${outputType}}
26-
${methodName}(input: ${method.input.name} | ${method.input.name}Json): {result: () => ${outputType}} {
27-
// Cast to native overload signature - the impl dispatches on $typeName.
28-
return this.client.${methodName}(this.runtime, input as ${method.input.name})
25+
${methodName}<TInput>(input: CapabilityInput<TInput, ${method.input.name}, ${method.input.name}Json>): {result: () => ${outputType}} {
26+
return this.client.${methodName}<TInput>(this.runtime, input)
2927
}
3028
}`
3129
}

0 commit comments

Comments
 (0)