Skip to content

Commit

Permalink
Hold typename keyed by symbol, so __typename__ isn't autocompleted.…
Browse files Browse the repository at this point in the history
… `__type__.name` is the proper path.
  • Loading branch information
CarsonF committed Sep 4, 2024
1 parent 1ace1e0 commit 476d8e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/generate/src/syntax/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type getChildOfObjectTypeSet<
ChildKey extends keyof Root["__element__"]["__pointers__"],
> = TypeSet<
ChildKey extends "name"
? Root extends { __typename__: string }
? ScalarType<"std::str", string, Root["__typename__"]>
? Root extends { [typenameSymbol]: string }
? ScalarType<"std::str", string, Root[typeof typenameSymbol]>
: Root["__element__"]["__pointers__"][ChildKey]["target"]
: Root["__element__"]["__pointers__"][ChildKey]["target"],
cardutil.multiplyCardinalities<
Expand Down Expand Up @@ -184,6 +184,8 @@ export type getPropsShape<T extends ObjectType> = typeutil.flatten<
}>
>;

const typenameSymbol = Symbol("typename");

export type $expr_PathNode<
Root extends ObjectTypeSet = ObjectTypeSet,
Parent extends PathParent | null = PathParent | null,
Expand All @@ -194,7 +196,7 @@ export type $expr_PathNode<
__cardinality__: Root["__cardinality__"];
__parent__: Parent;
__kind__: ExpressionKind.PathNode;
__typename__: TypeName;
[typenameSymbol]: TypeName;
// __exclusive__: boolean;
"*": getPropsShape<Root["__element__"]>;
}>;
Expand Down

0 comments on commit 476d8e2

Please sign in to comment.