question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to set default edge type when using typescript

See original GitHub issue

I am trying to set the default edge type to step. The documentation shows that the react flow component takes an edge type prop with the default one being :

{
  default: BezierEdge,
  straight: StraightEdge,
  step: StepEdge,
  smoothstep: SmoothStepEdge
}

So I would like to make mine be something like:

{
  default: StepEdge,
  straight: StraightEdge,
  smoothstep: SmoothStepEdge
}

However I cant seem to find out how to import the edge types in order to make the above object. Any hints on how to accomplish this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
Vasanthkumar26commented, Sep 5, 2022

Resolved

const onConnect = useCallback((params)=> setEdges(addEdge({...params, type:"smoothstep"}, edges)) );

Thanks for your support

2reactions
stoneprestoncommented, Jul 20, 2021

Should work with v9.6.5

That did it! Thanks! Is there a way to change the path that gets displayed when you are connecting nodes? ie right now when I click on a handle and drag the bezier path is drawn, is that configurable somehow?

Edit: found it!

<ReactFlow 
      connectionLineType={ConnectionLineType.Step}
>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typing defaultProps - React TypeScript Cheatsheets
The consensus is to use object default values. Function Components: type GreetProps = { age?: number }; const Greet = ({ age =...
Read more >
TSConfig Reference - Docs on every TSConfig option
The path may use Node.js style resolution. ... are included (e.g. .ts , .tsx , and .d.ts by default, with .js and .jsx...
Read more >
How to set default value to param that has type keyof (from an ...
I am having trouble in Typescript passing default values ...
Read more >
Default Props in React/TypeScript - DEV Community ‍ ‍
I'm not gonna go through a tutorial on that here. Suffice it to say that AllPropsRequired is a type that will make all...
Read more >
TypeScript Programming with Visual Studio Code
Another option is to install the TypeScript compiler locally in your project ( npm install --save-dev typescript ) and has the benefit of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found