google-fabric / velocity-react

React components for Velocity.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please provide Typings

MartinHaeusler opened this issue · comments

I just gave this library a shot, primarily because I was:

  • looking for a simpler, more robust to CSSTransitionGroup
  • trying to do a slideUp and slideDown Effect on an auto-sized container (which CSS can't do)

I am honestly amazed by this library, both the core velocity.js and the smooth react integration. It just fits!

Many react users (including me) are quite fond of TypeScript, even react itself comes with all typings included. This library would be even more awesome if it had a velocity-react.d.ts file to help with code completion and error checking. My own knowledge of this library is too limited to have a holistic picture of all possible settings. Is there any chance you could provide the typings? I already checked the web for existing typings for this library, but there are none it seems...

I'm open to PRs, but won't implement this personally.

Note that most of the typing would actually come from Velocity.js, since these components pass through many of the props.

Well, as it happens, there are typings for Velocity already (however, I don't know how complete they are):

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/354cec620daccfa0ad167ba046651fb5fef69e8a/types/velocity-animate/index.d.ts

... just if anybody is interested in doing this. I'm just starting out with this library.

Okay I took a look at it after all. Using your NPM documentation, I was able to figure out most things I think. I have attached my velocity-react.d.ts file to this post (velocity-react.d.ts.zip; I had to zip it because GitHub does not accept *.ts files as attachments).

This file has no guarantee for completion, but it works to get the basic examples going and give some guidance. It also lists the names of all animations that are included in velocity by default.

This file has absolutely zero dependencies to velocity typings. For attributes/references that refer to velocity, this typings file uses Object. This is because the standard velocity typings are crawling with Object and any types to begin with, so there is not much point in including them.

Feel free to do with this file whatever you want. If you take a look and see something missing, please, by all means, do update it. This is merely what I can make of the documentation.

Thanks for putting this together. I'll try and take a look and see about getting it in. I use Flow rather than TypeScript in my own projects, so I'd have to get familiar with it first.

@finneganh @MartinHaeusler Any further progess on this? Typings would be super useful as typescript has gained a lot of momentum since google endorsed it for angular... It makes the api a lot more discoverable too.

Hi @fionawhim, are you planning to add Typings?

dude it's almost four years since this issue was created. just bumping here to see what happens 🤷🏻‍♂️