Comments (17)
@jonthomp I created a pull request here #341. Not sure, if this is the correct way to do it though.
from tabler-react.
The main reason I ask is if it were to be defined manually, it would be difficult to maintain as the tabler-react library changes or individual components' props change
from tabler-react.
Alright. I'll get started with that.
from tabler-react.
@m8r1x My first attempt at typings (so I'm not sure it's right).
from tabler-react.
@jonthomp Can you say how the pull request from @shreedhan looks to you? I'd love to see it merged if it's ok.
from tabler-react.
This should be done at DT not here!
from tabler-react.
I could take this.
My approach would be to define the .d.ts
files then copy them, maybe using cpx for cross-platform compatiblility sake, to the dist
when the npm build
script is triggered, hence bundling them together with the package.
If that's alright I can get started asap.
from tabler-react.
@m8r1x That approach sounds good to me - just a quick question first. I am by no means an expert in TypeScript, so I was wondering how you would be defining the .d.ts
files? Would it be done manually or will there be some way of converting the flow types to ts types?
from tabler-react.
I've always opted for manual definition since I've never really found a great tool to auto generate from flow/js as intended.
Whenever I need the auto generate typings feature I opt to use Typescript from the start and let the compiler know that I need it using the declaration
flag set to true
.
react-to-typescript-definitions does a decent job but it relies on propTypes
object definition to get the props type ts definitions.
I've also never used this package before but from the README it seems to also need propTypes
definitions for stateless components.
from tabler-react.
This is the closest thing I can find https://github.com/bcherny/flow-to-typescript and that doesn't look super stable at the moment. Might be best to do manually for now, and then migrate to something like that once something mature is available
from tabler-react.
It looks great @zoubarevm
It'd be nice to get your feedback/thoughts on this variation as well
from tabler-react.
@m8r1x I was wondering how you would do the NestedComponents. Looks good to me!
from tabler-react.
Is this going to be merged anytime soon?
from tabler-react.
@shreedhan I imagine this needs updating before being merged, would you be able to take a look and see? I've recently been having to use Typescript on some projects so will also try to have a look at some point
from tabler-react.
@levino Depends on how the project wants to handle it.
from tabler-react.
I would rather say it depends on whether or not the maintainers want to follow best practices or do something funky their own way. https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html
Publishing
Now that you have authored a declaration file following the steps of this guide, it is time to publish it to > npm. There are two main ways you can publish your declaration files to npm:
- bundling with your npm package, or
- publishing to the @types organization on npm.
If your package is written in TypeScript then the first approach is favored. Use the --declaration flag to > generate declaration files. This way, your declarations and JavaScript will always be in sync.
If your package is not written in TypeScript then the second is the preferred approach
from tabler-react.
Maybe someone could open an issue over there and reference it here.
from tabler-react.
Related Issues (20)
- Form.Input clickable or Time Picker.
- What does feedback property do on Form.Input?
- Grid/Table Pagination HOT 2
- Is this project still maintained? HOT 11
- eslint 5.12.00 HOT 1
- Add indeterminate prop to Form.Checkbox HOT 1
- Could I use demo (example) tabler-react in production ?
- Tabler react loading time is too much HOT 2
- Translate 'Mark All As Read' button HOT 2
- SCSS version for Tabler.css HOT 1
- Is there going to be version 1 support after v2 release?
- Replace text-decoration-skip: ink to text-decoration-skip-ink: auto
- Where's the old website for v1? HOT 4
- React-Hook-Form Property in Form.Input
- Icoan Custom
- Error: Can't resolve '/img/flags/ad.svg' HOT 4
- [Feature Request] Add support for iconPosition in Button
- is the repo still alive? HOT 2
- Is Tabler React official DEAD IN 2022 ? HOT 3
- Typescript Definitions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tabler-react.