Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RelativeTime component appears broken #4836

Open
pveierland opened this issue Aug 10, 2024 · 6 comments
Open

RelativeTime component appears broken #4836

pveierland opened this issue Aug 10, 2024 · 6 comments
Labels
bug Something isn't working needs triage react

Comments

@pveierland
Copy link

pveierland commented Aug 10, 2024

Description

The typing and import of RelativeTime component appears broken in v36.27.

Steps to reproduce

  1. Create App.tsx with:
import { RelativeTime } from "@primer/react";

export default function App() {
  return (
    <RelativeTime date={new Date("2020-01-01T00:00:00Z")} noTitle={true} />
  );
}
  1. When compiling locally with 36.27.0, this results in the type error Type 'Date' is not assignable to type 'never'.

CodeSandbox 36.27.0 Error: Could not find module in path: '@primer/react/lib/node_modules/@oddbird/popover-polyfill/dist/popover-fn.js' relative to '/node_modules/@primer/react/lib/TooltipV2/Tooltip.js'

CodeSandbox 35.10.0: Error: Module '"@primer/react"' has no exported member 'RelativeTime'.

Version

v36.27

Browser

Chrome, Firefox

@pveierland pveierland added the bug Something isn't working label Aug 10, 2024
@Raj3110
Copy link

Raj3110 commented Aug 11, 2024

image

Code runs perfectly fine!! despite of having type errors.

Copy link
Contributor

Uh oh! @Raj3110, the image you shared is missing helpful alt text. Check #4836 (comment).

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@lesliecdubs
Copy link
Member

Hi, thanks for reporting. Are you able to share more about the environment where you're running into this? Are you using a framework like Next.js?

@0xtrou
Copy link

0xtrou commented Aug 21, 2024

while building our nextjs app, I got error

unhandledRejection Error: Cannot find module '../node_modules/@oddbird/popover-polyfill/dist/popover-fn.js'

@pveierland
Copy link
Author

Hi, thanks for reporting. Are you able to share more about the environment where you're running into this? Are you using a framework like Next.js?

Yes, using @next==14.2.5 and typescript==5.5.4 locally.

@lesliecdubs
Copy link
Member

lesliecdubs commented Aug 26, 2024

Hi, thanks for letting us know. We think this likely has to do with the popover polyfill mentioned in #4836 (comment). Another instance of this bug here: #4280 (comment).

@keithamus do you know of any workarounds for folks using Primer who run into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage react
Projects
None yet
Development

No branches or pull requests

5 participants