Setting up custom types for Edge Attributes #899
-
Hi there, I am following your README to set up custom attributes on Edge. I have set up a custom.d.ts file as below. import { $keywords } from 'ts-graphviz';
declare module 'ts-graphviz' {
export namespace EdgeAttributeKey {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface $values extends $keywords<'testDir' | 'testCaller'> { }
}
export namespace Attribute {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface $keys extends $keywords<'testDir' | 'testCaller'> { }
export interface $types {
testDir: 'pull' | 'push' | 'both';
testCaller: string;
}
}
} And in the code, I use it as such: graph.attributes.edge.set(attribute.testDir, "s"); I do get autocompletion for Any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@cloud-on-prem Thanks for the question! I checked at hand and reproduced the problem, so there may be something unexpected. Specifically, there seems to be a problem with the specification in set, since the type validation did not take effect even with the following. graph.attributes.edge.set(attribute.color, 's'); I will convert this question to an issue and manage it. |
Beta Was this translation helpful? Give feedback.
@cloud-on-prem
The issue has been resolved in the v1.8.1 update. We appreciate the impact of your question on enhancing the library's quality 🥇