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

fix: Add TypeScript definitions #223

Merged
merged 8 commits into from
Mar 31, 2019
Merged

fix: Add TypeScript definitions #223

merged 8 commits into from
Mar 31, 2019

Conversation

ellinge
Copy link
Collaborator

@ellinge ellinge commented Mar 21, 2019

Adds TypeScript-definitions

I also noticed that onAction is not correctly implemented. Currently sends a { action: string, id: string }.
There is code in index.js which tries to fetch the node. But it does not seem be working. It expects two parameters but receives the object described above in the first parameter.
bild

Changed the examples/stories to get the node id at least.
Also changed in readme where onAction should be applied.

Fixes #209

  • New feature

@coveralls
Copy link

coveralls commented Mar 21, 2019

Pull Request Test Coverage Report for Build 943

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.843%

Totals Coverage Status
Change from base Build 915: 0.0%
Covered Lines: 323
Relevant Lines: 333

💛 - Coveralls

@ellinge
Copy link
Collaborator Author

ellinge commented Mar 21, 2019

Tested with npm install git:
bild

Currently based on develop so radioSelect (and id is missing).

@mrchief
Copy link
Collaborator

mrchief commented Mar 21, 2019

@ellinge This is really great!

@mrchief
Copy link
Collaborator

mrchief commented Mar 21, 2019

Are you done with this? It seems like we can merge this and get a release out (will get radio once #217 gets merged).

Also, I think we should separate out action related changes (see my comments regarding them) so that we can get the typings out.

README.md Show resolved Hide resolved
@ellinge
Copy link
Collaborator Author

ellinge commented Mar 21, 2019

Are you done with this? It seems like we can merge this and get a release out (will get radio once #217 gets merged).

Also, I think we should separate out action related changes (see my comments regarding them) so that we can get the typings out.

I want to be sure with the typings for onAction first. I think we need to split TreeNode (props and return) as well since the return-object does not include children anymore (it's set to undefined). Should we expose the _id/id props as well?

Do you think we should expose any "internal" props and methods as well. Such as node and searchInput. We actually use them to set the width of the dropdown to the div-node and handling tabbing in and out of the dropdown. I guess others are interested in their expose as well without casting the whole ref to any instead.

TS2339: Property 'handleClick' does not exist on type 'DropdownTreeSelect'.
TS2339: Property 'keepDropdownActive' does not exist on type 'DropdownTreeSelect'.
TS2339: Property 'node' does not exist on type 'DropdownTreeSelect'.
TS2339: Property 'searchInput' does not exist on type 'DropdownTreeSelect'.

@mrchief
Copy link
Collaborator

mrchief commented Mar 21, 2019

Should we expose the _id/id props as well?

No, since they are internal to the component. If anyone needs id, they can pass their own and the component will use them. I don't want anyone relying on our internal mechanism of generating IDs.

Do you think we should expose any "internal" props and methods as well. Such as node and searchInput. We actually use them to set the width of the dropdown to the div-node and handling tabbing in and out of the dropdown. I guess others are interested in their expose as well without casting the whole ref to any instead.

Let me think about this and I'll get back to you.

@mrchief mrchief added enhancement wip Work In Progress labels Mar 21, 2019
@codeclimate
Copy link

codeclimate bot commented Mar 31, 2019

Code Climate has analyzed commit 3cad026 and detected 0 issues on this pull request.

View more on Code Climate.

@mrchief mrchief merged commit 528b38f into dowjones:develop Mar 31, 2019
@mrchief mrchief removed the wip Work In Progress label Mar 31, 2019
@mrchief
Copy link
Collaborator

mrchief commented Mar 31, 2019

Many thanks for adding this!

@ellinge ellinge deleted the fix/#209 branch March 31, 2019 20:49
mrchief pushed a commit that referenced this pull request Apr 2, 2019
## What does it do?

An issue in #223 for children. An array of Node[] instead of TreeNode[] was specified.

## Type of change

- [x] Bug fix
mrchief pushed a commit that referenced this pull request Apr 18, 2019
Adds TypeScript-definitions

I also noticed that onAction is not correctly implemented. Currently sends a { action: string, id: string }.
There is code in index.js which tries to fetch the node. But it does not seem be working. It expects two parameters but receives the object described above in the first parameter.
![bild](https://user-images.githubusercontent.com/17863113/54728331-8d972980-4b7d-11e9-9490-a3bd6b08481f.png)

Changed the examples/stories to get the node id at least.
Also changed in readme where onAction should be applied.

Fixes #209 

- [X] New feature
mrchief pushed a commit that referenced this pull request Apr 18, 2019
## What does it do?

An issue in #223 for children. An array of Node[] instead of TreeNode[] was specified.

## Type of change

- [x] Bug fix
@mrchief
Copy link
Collaborator

mrchief commented Jun 10, 2019

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

TypeScript bindings
3 participants