tien commented on code in PR #2599:
URL: https://github.com/apache/tinkerpop/pull/2599#discussion_r1632121152


##########
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.ts:
##########
@@ -43,27 +42,32 @@ export class Graph {
   }
 }
 
-class Element {
+class Element<TLabel extends string = string, TId = any> {
   constructor(
-    readonly id: string,
-    readonly label: string,
+    readonly id: TId,
+    readonly label: TLabel,

Review Comment:
   In TypeScript, we have string literal, which can be a generic, for example:
   
   ```ts
   type Foo<T> = T;
   
   type Bar = Foo<"string-literal">;
   ```
   
   Here the type of `T` will be `"string-literal"` instead of a plain `string`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to