Skip to content
This repository was archived by the owner on Jun 30, 2026. It is now read-only.

Commit 56aa9c5

Browse files
maorlegerCopilot
andcommitted
style(typespec-ts): format rewrite regression fixes
Apply formatter output for the client-context and model-renderer regression fixes after re-running build and unit validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e8b5a80 commit 56aa9c5

3 files changed

Lines changed: 26 additions & 11 deletions

File tree

packages/typespec-ts/src/codegen/clients.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,7 @@ function emitReturnStatement(
323323
): void {
324324
const contextRequiredParams = client.parameters.filter(
325325
(p) =>
326-
!p.isEndpoint &&
327-
!p.isCredential &&
328-
p.name !== "options" &&
329-
p.required
326+
!p.isEndpoint && !p.isCredential && p.name !== "options" && p.required
330327
);
331328

332329
const requiredParamNames = new Set(

packages/typespec-ts/src/codegen/models.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@ export function emitModelFiles(
2020
codeModel: TSCodeModel,
2121
sdkContext: SdkContext
2222
): SourceFile[] {
23-
const rawModelLookup = buildRawTypeLookup(sdkContext.sdkPackage.models, sdkContext);
24-
const rawEnumLookup = buildRawTypeLookup(sdkContext.sdkPackage.enums, sdkContext);
25-
const rawUnionLookup = buildRawTypeLookup(sdkContext.sdkPackage.unions, sdkContext);
23+
const rawModelLookup = buildRawTypeLookup(
24+
sdkContext.sdkPackage.models,
25+
sdkContext
26+
);
27+
const rawEnumLookup = buildRawTypeLookup(
28+
sdkContext.sdkPackage.enums,
29+
sdkContext
30+
);
31+
const rawUnionLookup = buildRawTypeLookup(
32+
sdkContext.sdkPackage.unions,
33+
sdkContext
34+
);
2635
const includedModelKeys = new Set<string>();
2736

2837
for (const model of codeModel.models) {
29-
const rawModel = rawModelLookup.get(getTypeKey(model.name, model.namespace));
38+
const rawModel = rawModelLookup.get(
39+
getTypeKey(model.name, model.namespace)
40+
);
3041
if (!rawModel) {
3142
continue;
3243
}
@@ -41,7 +52,9 @@ export function emitModelFiles(
4152
}
4253

4354
for (const enumType of codeModel.enums) {
44-
const rawEnum = rawEnumLookup.get(getTypeKey(enumType.name, enumType.namespace));
55+
const rawEnum = rawEnumLookup.get(
56+
getTypeKey(enumType.name, enumType.namespace)
57+
);
4558
if (!rawEnum) {
4659
continue;
4760
}

packages/typespec-ts/test/modularUnit/adapter.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,13 @@ describe("tcgc adapter", () => {
402402
);
403403

404404
const client = model.clients[0]!;
405-
const apiVersion = client.parameters.find((parameter) => parameter.isApiVersion);
406-
expect(apiVersion).toMatchObject({ required: false, hasDefaultValue: true });
405+
const apiVersion = client.parameters.find(
406+
(parameter) => parameter.isApiVersion
407+
);
408+
expect(apiVersion).toMatchObject({
409+
required: false,
410+
hasDefaultValue: true
411+
});
407412

408413
const project = new Project({ useInMemoryFileSystem: true });
409414
const binder = provideBinder(project);

0 commit comments

Comments
 (0)