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.

Typescript error for <Handle> prop

See original GitHub issue

I’m using <Handle> within a custom node component and I get the following Typescript error:

TS2322: Type '"top"' is not assignable to type 'Position'.

Using 1.3.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
moklickcommented, May 15, 2020

Hey,

we didn’t exported all types. You should now be able to import the Position enum:

import { Handle, Position } from 'react-flow-renderer';

const HandleWithPosTop = (
  <Handle 
    position={Position.Top}
  />
);

This should work with v.1.3.7

0reactions
moklickcommented, May 26, 2020

Hey

Read more comments on GitHub >

github_iconTop Results From Across the Web

React component throwing TypeScript error for function ...
The first param to Component type is props type , and you have not defined it, therefore the error. Define a interface,
Read more >
Error Boundaries - React TypeScript Cheatsheets
React-error-boundary - is a lightweight package ready to use for this scenario with TS support built-in. This approach also lets you avoid class...
Read more >
Typescript component does not throw error if different prop ...
I am in the process of migrating my React project to typescript. I've managed to convert a smaller component and it's working as...
Read more >
Handle Props in React in TypeScript
Handle Props in React in TypeScript. In this article, I will describe some issues you may encounter making illegal props unrepresentable in React....
Read more >
Deciphering TypeScript's React errors | by Fiona Hopkins |
The combination of TypeScript and React can lead to some hairy error messages when you get one of your props wrong. This guide...
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