The 2.2.0 release has broken TypeScript typings

3
closed
julienvincent
julienvincent
Posted 4 months ago

The 2.2.0 release has broken TypeScript typings #673

Bug report 🐞

Version & Environment

  • Version of browser - N/A
  • Version of geist-ui/react - v2.2.2

Expected Behaviour

The expected behaviour while using geist-ui in a TypeScript project would be to have detailed typings for all exported components. This seems to be a regression from 2.1.5 whose types continue to work as expected.

Actual results (or Errors)

All exported components are typed as any:

image

Including nested components:

image

Workarounds

A really hacky and temporary workaround was to install an aliased version of @geist-ui/[email protected] and re-declare the type exports.

// package.json

{
  "dependencies": {
    "@geist-ui/react": "^2.2.2",
    "geist-types": "npm:@geist-ui/[email protected]",
  }
}
// geist.d.ts

declare module '@geist-ui/react' {
  export * from 'geist-types';
}

This obviously results in some type mismatches, for example while using the Spacer component which had a breaking change. For this case I am using @ts-ignore statements.

...
  {/* @ts-ignore */}
  <G.Spacer w={1}></G.Spacer>
...
unix
unix
Created 4 months ago

I have released a development version to fix the type error, you can use it for development first: yarn add @geist-ui/[email protected], and a patch version will be released later.

unix
unix
Created 4 months ago

Version 2.2.3 has been released(yarn add @geist-ui/[email protected]) and tests show that this type of bug has been fixed.

For any follow-up on this issue, please reopen.

julienvincent
julienvincent
Created 4 months ago

Works! Thanks 🎉