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

[lexical-code] Bug Fix: Add global type declarations for Prism #6736

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

etrepum
Copy link
Collaborator

@etrepum etrepum commented Oct 15, 2024

Description

When investigating #6731 (comment) it was reported that npm run ci-check failed locally due to a type error. It's unclear why this failure doesn't also happen in CI, but I was able to reproduce it locally. The root cause probably has something to do with @types/prismjs and how the CI installs things?

All this does is add some type annotations to make it pass.

Test plan

Before

$ npm run tsc

> @lexical/monorepo@0.18.0 tsc
> tsc

packages/lexical-code/src/CodeHighlighterPrism.ts:28:59 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.

28 export const Prism: typeof import('prismjs') = globalThis.Prism || window.Prism;
                                                             ~~~~~

packages/lexical-code/src/CodeHighlighterPrism.ts:28:75 - error TS2339: Property 'Prism' does not exist on type 'Window & typeof globalThis'.

28 export const Prism: typeof import('prismjs') = globalThis.Prism || window.Prism;
                                                                             ~~~~~


Found 2 errors in the same file, starting at: packages/lexical-code/src/CodeHighlighterPrism.ts:28

After

$ npm run tsc

> @lexical/monorepo@0.18.0 tsc
> tsc

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 15, 2024
Copy link

vercel bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 7:55pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 7:55pm

Copy link

size-limit report 📦

Path Size
lexical - cjs 29.94 KB (0%)
lexical - esm 29.81 KB (0%)
@lexical/rich-text - cjs 38.54 KB (0%)
@lexical/rich-text - esm 31.61 KB (0%)
@lexical/plain-text - cjs 37.15 KB (0%)
@lexical/plain-text - esm 28.99 KB (0%)
@lexical/react - cjs 40.34 KB (0%)
@lexical/react - esm 33.08 KB (0%)

@etrepum etrepum added this pull request to the merge queue Oct 16, 2024
Merged via the queue into facebook:main with commit 027acd6 Oct 16, 2024
38 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants