Closed crutchcorn closed 3 hours 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.
@TylerBarnes I'ts workind, I tested it on my project.
@crutchcorn add this lines on the AniLinkProps interface:
title?: string;
target?: string;
any joy?
@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
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 atrigger
function accessing anexit
state, but that's a level of complexity in typings that I wouldn't be comfortable introducing as an initial set of typingsCloses #115 #155