Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using exported types for TypeScript #231

Closed
TomlDev opened this issue Aug 22, 2019 · 4 comments
Closed

Using exported types for TypeScript #231

TomlDev opened this issue Aug 22, 2019 · 4 comments

Comments

@TomlDev
Copy link

TomlDev commented Aug 22, 2019

Are you reporting a bug, or opening a feature request?

feature request

What is the actual behavior/output?

I cannot use the types (eg. NodeSvgShape/ReactD3TreeItem) because they don't get exported.

What is the behavior/output you expect?

That I can use the react-d3-tree types in my project for type-validation

What version of react-d3-tree are you using?

latest

@bkrem
Copy link
Owner

bkrem commented Aug 22, 2019

Hi @TomlDev, thanks for pointing that out, oversight on my part in terms of exporting all relevant types when I set up the definition file.

It should be fixed now in v1.14.1 (61e3351)

Feel free to reopen if there's still an issue.

@bkrem bkrem closed this as completed Aug 22, 2019
@TomlDev
Copy link
Author

TomlDev commented Aug 23, 2019

Thanks @bkrem !
Another thing that occurs (and that was the initial reason I needed those types) is that onUpdate option passes a ReactD3TreeItem as first parameter, but that data also includes zoom & translate attributes which don't occur in ReactD3TreeItem.. Shall I open a new issue for that?

@bkrem
Copy link
Owner

bkrem commented Aug 23, 2019

Oh wow yeah great point, that's been wrong all along 🤦‍♂ this is the issue with retrofitting typings onto an old codebase.

Thanks for pointing that out too 💯 I've updated the type declarations and the docs (ac7ba4f) and published as v1.14.2.

I had a quick play around with it, but feel free to open another issue if the types are still problematic in some way.

@TomlDev
Copy link
Author

TomlDev commented Aug 26, 2019

Thanks @bkrem, I get this error after updating:

TypeError: a is null
value
node_modules/react-d3-tree/lib/react-d3-tree.min.js:1024

  1021 | 
  1022 | if (n) {
  1023 |   var i = "object" === (void 0 === a ? "undefined" : u(a)),
> 1024 |       s = i ? a.x : 0,
       | ^  1025 |       l = i ? a.y : 0;
  1026 |   return "horizontal" === t ? "translate(" + l + "," + s + ")" : "translate(" + s + "," + l + ")";
  1027 | }

t
node_modules/react-d3-tree/lib/react-d3-tree.min.js:970

  967 | }
  968 | 
  969 | return n = r = a(this, (e = t.__proto__ || Object.getPrototypeOf(t)).call.apply(e, [this].concat(l))), r.state = {
> 970 |   transform: r.setTransform(r.props.nodeData, r.props.orientation, !0),
      | ^  971 |   initialStyle: {
  972 |     opacity: 0
  973 |   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants