geist-org / geist-ui

A design system for building modern websites and applications.
https://geist-ui.dev
MIT License
4.33k stars 334 forks source link

The 2.2.0 release has broken TypeScript typings #673

Closed julienvincent closed 2 years ago

julienvincent commented 2 years ago

Bug report 🐞

Version & Environment

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/react@2.1.5 and re-declare the type exports.

// package.json

{
  "dependencies": {
    "@geist-ui/react": "^2.2.2",
    "geist-types": "npm:@geist-ui/react@2.1.5",
  }
}
// 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 commented 2 years ago

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

unix commented 2 years ago

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

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

julienvincent commented 2 years ago

Works! Thanks 🎉