TylerBarnes / gatsby-plugin-transition-link

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

TypeScript definitions missing #155

Open akselinurmio opened 4 years ago

akselinurmio commented 4 years ago

Currently, when using the plugin within a TypeScript file, the validating tools complain about missing type declarations. All of the components imported from the plugin (TransitionLink, AniLink, TransitionState and TransitionPortal) are implicitly set as type any.

For example,

import TransitionLink from "gatsby-plugin-transition-link"

results in errors like

Could not find a declaration file for module 'gatsby-plugin-transition-link'. 'node_modules/gatsby-plugin-transition-link/index.js' implicitly has an 'any' type.
  Try `npm install @types/gatsby-plugin-transition-link` if it exists or add a new declaration (.d.ts) file containing `declare module 'gatsby-plugin-transition-link';`

That means that things work just fine, but there’s no TypeScript magic ✨ when it comes to using the plugin.

The way to fix this would be to add a declaration file, of course. I think it would make the plugin a lot more usable in TypeScript environments.

TylerBarnes commented 4 years ago

@akselinurmio this is a great idea!

crutchcorn commented 4 years ago

I'll start on the typings tonight

chrisbward commented 3 years ago

How did it go in the end?

crutchcorn commented 3 years ago

Typings work for me. See #202 for PR implementing