virtualvivek / react-windows-ui

Build Windows native look & feel apps using ReactJS. Provides a set of accessible, reusable and composable react components that make it super easy to create websites and apps.
https://virtualvivek.github.io/react-windows-ui/
MIT License
537 stars 44 forks source link

There are no type definitions available for use with typescript #3

Closed Unluckymichell closed 3 years ago

Unluckymichell commented 3 years ago

I would like to use these components in a typescript / react project. (I will do a fork later this week and create the definitions myself)

virtualvivek commented 3 years ago

Hi @Unluckymichell , Glad to hear that you use react-windows-ui in your project, I am apologizing for not added d.ts files to this project this issue is also pinged by @Myzel394 And now i believe that the d.ts files are needed asap.

so stared figuring out creating the files if you are thinking of creating the files please also create a pull request we will be happy or also try it by myself so it can be compatible with typescript project.

Myzel394 commented 3 years ago

I think it would be better to refactor the jsx files to tsx files now. Otherwise we will be later at the same moment as we are now. @virtualvivek

virtualvivek commented 3 years ago

HI @Myzel394 , @Unluckymichell , I started to create typing for the available .jsx components @Myzel394 can it be sufficient for now to use only typings, i have checked few components currently and working great with VSCode and intelliSense.

@Myzel394 if you are interested to optimize the .d.ts you can also do that. iam on the way completing this file

tperscripting

Myzel394 commented 3 years ago

@virtualvivek Please don't put all definitions in one file. Create a d.ts file for each component. This way you profit from a clean code base :D

virtualvivek commented 3 years ago

@Myzel394 yes you are right i forget that in future if we have to edit any component it will become blender to search in a big d.ts file for now will create it for each component seperately. Thanks for the suggestion.

Myzel394 commented 3 years ago

Btw, AFAIK "SFC" shouldn't be used, you can simply use "Component" and pass the props as a generic to it

virtualvivek commented 3 years ago

it will like this??

export interface ButtonProps {
    value?: string;
}
declare const Button: React.Component<ButtonProps>
Myzel394 commented 3 years ago

Exactly, I did it like this reactwindowsui.PNG

virtualvivek commented 3 years ago

Thankyou @Myzel394 for helping me out :smile: Regards you both @Unluckymichell and @Myzel394 for pingind for typescripting maybe it will never added without this pings.

Unluckymichell commented 3 years ago

Nice to see this added so fast. If i can still help with any types or if i should update the jsx to tsx files later please tell me.

Myzel394 commented 3 years ago

@virtualvivek you can also contact me over Matrix @myzel394:matrix.org

virtualvivek commented 3 years ago

Hi @Unluckymichell , I have added all the type definitions, yes you can help us in many ways, Can you please see the type definitions and check everything is fine to be deployed. You can find speific .d.ts files using link: src/lib/src/components/ComponentName/index.d.ts

We can close this issue after successful publishing in @npm.

virtualvivek commented 3 years ago

Hi @Myzel394 , Sure i can contact you if encountered in any issue. :D Thankyou in advance.

Unluckymichell commented 3 years ago

@virtualvivek See my pull request #4