-
Notifications
You must be signed in to change notification settings - Fork 47
Add typings #77
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
Add typings #77
Conversation
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
=======================================
Coverage 96.69% 96.69%
=======================================
Files 7 7
Lines 635 635
Branches 22 22
=======================================
Hits 614 614
Misses 21 21 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
looks awesome, thanks! Just a small correction:
|
@IanStorm would you mind make the change, and double check it still works? Then we should be able to merge it, thanks! |
Sure, @shunjizhan, I will perform the requested amendments and ping you once the PR is ready for review again. |
Hey @shunjizhan, please take a look at the PR again. I tweaked the initially mentioned snippet a little bit to test your requested changes. VS Code completion still worked, as well as the TS compilation. Console logs were showing the extra fields that I added. import 'react-folder-tree/dist/style.css';
import ReactDOM from 'react-dom';
import FolderTree, { NodeData, testData } from 'react-folder-tree';
const myTestData: NodeData = { ...testData };
myTestData.name = 'This is my test data'; // instead of 'All Cryptos'
myTestData.myField = 2;
myTestData.nickname = 'texty text';
myTestData.url = 'https://www.google.com';
const BasicTree = (): JSX.Element => {
return (
<FolderTree
data={myTestData}
iconComponents={{FileIcon: () => null}}
initCheckedStatus='checked'
initOpenStatus='open'
indentPixels={100}
onChange={(state, event) => console.log('*** onChange ***', 'state:', state, 'event:', event)}
onNameClick={({defaultOnClick, nodeData}) => {
console.log('*** onNameClick ***', 'nodeData:', nodeData);
defaultOnClick();
}}
readOnly={false}
showCheckbox={true}
/>
);
};
ReactDOM.render(
<BasicTree />,
document.getElementById('root'),
); Looking forward to your feedback. |
looks great! |
Thank you both @IanStorm @shunjizhan This seems to be the best FOSS react folder tree module out there, and it's great we can now use Typescript with it |
Resolves #66
Running the
lint
script throws 4 errors, but this also happened before I applied my changes. The output of thebuild
,start
, andtest
scripts looked good to me.I tested the changes locally by running
yarn pack
and installing the resulting.tgz
file in a small React project. I basically used the snippet below to play around with the lib. VS Code code completion worked, TS compiler was fine; the project was bootstrapped usingnpx create-react-app react-folder-tree-test --template typescript
:Please ping me if you want me to bump the version, or if you think any documentation change is required.
Looking forward to your feedback.