Typescript types - add more type for `layout` object #3582
cliffordfajardo posted onGitHub
Describe the bug
As a user who is adding using G6, I would like to get type completions while I am configuring my layout
object
Only a subset of the valid options are available.
<img width="1244" alt="CleanShot 2022-03-15 at 09 33 36@2x" src="https://user-images.githubusercontent.com/6743796/158426562-07d5ee76-f788-4e2c-9a96-889c39d5a9e7.png">
Your Example Website or App
https://codesandbox.io/s/charming-fast-sbl3og
Steps to Reproduce the Bug or Issue
- Attempt to type in
nodeSpacing
orcomboPadding
or any other valid property that you can pass to thelayout
object. You will notice that we are not getting intellisense / autocomplete in your IDE / code editor.
Currently only a few properties (5) are exposed on layout
the last one is [key: string]: unknown;
which allows us to pass other values not defined, this doesnt help us know what is a valid value or not, meaning a user has to leave their text editing experience and go to the documentation to locate the information
Expected behavior
As a user, when I type comboPadding
, nodeSpacing
or any other valid value to the layout
object, my text editor/IDE should autocomplete that value for me.
https://user-images.githubusercontent.com/6743796/158428172-d02c8f5b-f7fb-4ab2-b897-7e83ac70672f.mp4