TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 70 forks source link

Initial TypeScript typings #202

Closed crutchcorn closed 3 hours ago

crutchcorn commented 4 years ago

Like most software, this can be improved in a few ways and likely includes some form of errors. Review from someone more familiar with the codebase would be appreciated.

I know one of the ways these typings can be made to be more strict would be to decouple state of entry and exit and make them persist as their own meta types, which would enforce your inability to access state that's only present on entry from a trigger function accessing an exit state, but that's a level of complexity in typings that I wouldn't be comfortable introducing as an initial set of typings

Closes #115 #155

TylerBarnes commented 4 years ago

Hi @crutchcorn , sorry for the extremely delayed response. To this day I haven't done much work with Typescript. Are you able to provide me some simple steps to get started trying out these typings in a project? I'm the only one deeply familiar with the codebase as far as I'm aware but like I mentioned I've only used Typescript a handful of times.

felipe-heredia commented 3 years ago

@TylerBarnes I'ts workind, I tested it on my project.

felipe-heredia commented 3 years ago

@crutchcorn add this lines on the AniLinkProps interface:

title?: string;
target?: string;
chrisbward commented 3 years ago

any joy?

crutchcorn commented 3 years ago

@TylerBarnes I am so sorry for not responding when you'd made a comment. I spaced on it as I had a lot going on at the time and it just fell from my radar.

The best way to test this would be to either:

1) Load up a TypeScript project that uses gatsby-plugin-transition-link and see if the code works as-intended 2) Add TypeScript type tests using dtslint. An example of that can be seen here:

https://github.com/plopjs/node-plop/tree/master/types

I can setup dtslint tests if that would be helpful. I admittedly didn't know how to do that at the initial time of this PR