Skip to content

Commit 41fbefb

Browse files
committed
Fix review findings: document implements clause behavior, remove unused imports
- Add explanatory comment on getComposition/iface.name in object-type.tsx clarifying that pre-mutation names match post-mutation names (mutation engine doesn't rename models) - Remove unused `type Model` import from all G2 test files
1 parent 90012a4 commit 41fbefb

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/graphql/src/components/types/object-type.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function ObjectType(props: ObjectTypeProps) {
2525
const implementations = getComposition(program, props.type);
2626
const operationFields = getOperationFields(program, props.type);
2727

28-
// Convert interface implementations to string references
28+
// Convert interface implementations to string references.
29+
// Note: getComposition returns original (pre-mutation) models from decorator state.
30+
// This works because the mutation engine doesn't rename models, so iface.name
31+
// matches the name used by InterfaceType for the same model.
2932
const implementsRefs = implementations?.map((iface) => iface.name) || [];
3033

3134
return (

packages/graphql/test/components/input-type.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { type Model } from "@typespec/compiler";
21
import { t } from "@typespec/compiler/testing";
32
import { describe, expect, it, beforeEach } from "vitest";
43
import { InputType } from "../../src/components/types/index.js";

packages/graphql/test/components/interface-type.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { type Model } from "@typespec/compiler";
21
import { t } from "@typespec/compiler/testing";
32
import { describe, expect, it, beforeEach } from "vitest";
43
import { InterfaceType } from "../../src/components/types/index.js";

packages/graphql/test/components/object-type.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { type Model } from "@typespec/compiler";
21
import { t } from "@typespec/compiler/testing";
32
import * as gql from "@alloy-js/graphql";
43
import { describe, expect, it, beforeEach } from "vitest";

0 commit comments

Comments
 (0)