Skip to content

Commit 02b245f

Browse files
Copilotv-jiaodi
andcommitted
Fix lint errors: replace deprecated correspondingMethodParams with methodParameterSegments
Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>
1 parent a9056d8 commit 02b245f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

packages/typespec-ts/src/modular/helpers/operationHelpers.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,9 @@ function getOperationSignatureParameters(
391391
p.type.kind !== "constant" &&
392392
operation.operation.parameters.filter((param) => {
393393
return (
394-
param.correspondingMethodParams.length === 1 &&
395-
param.correspondingMethodParams[0] === p
394+
param.methodParameterSegments.length === 1 &&
395+
param.methodParameterSegments[0]?.length === 1 &&
396+
param.methodParameterSegments[0]?.[0] === p
396397
);
397398
})[0]?.kind !== "cookie" &&
398399
p.clientDefaultValue === undefined &&
@@ -742,8 +743,8 @@ function getHeaderAndBodyParameters(
742743
}
743744
// Check if this parameter still exists in the corresponding method params (after override)
744745
if (
745-
param.correspondingMethodParams &&
746-
param.correspondingMethodParams.length > 0
746+
param.methodParameterSegments &&
747+
param.methodParameterSegments.length > 0
747748
) {
748749
parametersImplementation[param.kind].push({
749750
paramMap: getParameterMap(dpgContext, param, optionalParamName),
@@ -1075,9 +1076,12 @@ function getPathParameters(
10751076
const pathParams: string[] = [];
10761077
for (const param of operation.operation.parameters) {
10771078
if (param.kind === "path") {
1078-
pathParams.push(
1079-
`"${param.serializedName}": ${getPathParamExpr(param.correspondingMethodParams[0]!, getDefaultValue(param) as string, optionalParamName)}`
1080-
);
1079+
const methodParam = param.methodParameterSegments[0]?.[0];
1080+
if (methodParam) {
1081+
pathParams.push(
1082+
`"${param.serializedName}": ${getPathParamExpr(methodParam, getDefaultValue(param) as string, optionalParamName)}`
1083+
);
1084+
}
10811085
}
10821086
}
10831087

@@ -1108,8 +1112,8 @@ function getQueryParameters(
11081112
if (param.kind === "query") {
11091113
// Check if this parameter still exists in the corresponding method params (after override)
11101114
if (
1111-
param.correspondingMethodParams &&
1112-
param.correspondingMethodParams.length > 0
1115+
param.methodParameterSegments &&
1116+
param.methodParameterSegments.length > 0
11131117
) {
11141118
parametersImplementation[param.kind].push({
11151119
paramMap: getParameterMap(dpgContext, {

packages/typespec-ts/src/modular/helpers/typeHelpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export function buildPropertyNameMapper(
132132
* @returns
133133
*/
134134
export function isSpreadBodyParameter(body: SdkBodyParameter) {
135-
const methodParams = body.correspondingMethodParams;
135+
const methodParams = body.methodParameterSegments;
136136
return (
137137
methodParams.length > 1 ||
138-
(methodParams.length === 1 && methodParams[0]?.type !== body.type)
138+
(methodParams.length === 1 && methodParams[0]?.length === 1 && methodParams[0][0]?.type !== body.type)
139139
);
140140
}

0 commit comments

Comments
 (0)