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

fix: fix a few TS errors #5437

Merged
merged 8 commits into from
Aug 30, 2021
Merged

fix: fix a few TS errors #5437

merged 8 commits into from
Aug 30, 2021

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Aug 28, 2021

Motivation

The TypeScript compiler screams at me again after bumping to beta.5 when I ran tsc in my site repo. It turns out that CI checks fall short when it comes to the .d.ts files, so these mistakes tend to sneak in unnoticed.

Have you read the Contributing Guidelines on pull requests?

Yes

Test plan

cd website && yarn typecheck

This actually works well. Should we add it to the CI?

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 28, 2021
@netlify
Copy link

netlify bot commented Aug 28, 2021

✔️ [V2]

🔨 Explore the source changes: 1aa2cc5

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/612cb7fda8e187000787f5a4

😎 Browse the preview: https://deploy-preview-5437--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Aug 28, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 86
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5437--docusaurus-2.netlify.app/

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
@Josh-Cena
Copy link
Collaborator Author

Josh-Cena commented Aug 28, 2021

Okay this is annoying😅 As the website is also built into a PWA, it uses the workbox library which requires setting TS compiler to lib: ["webworker"], but "webworker" and "DOM" are incompatible. Therefore running typecheck in website is sure to fail. Not sure what we should do

Also, the new tsconfig still doesn't do its magic on resolving @site/ aliases

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay this is annoying😅 As the website is also built into a PWA, it uses the workbox library which requires setting TS compiler to lib: ["webworker"], but "webworker" and "DOM" are incompatible. Therefore running typecheck in website is sure to fail. Not sure what we should do

This seems to fix it:

  • "exclude": ["src/sw.js"]
  • Also skipLibChecks: true but the 1st is better. I don't think it's too important to type-check this file 🤪

Also, the new tsconfig still doesn't do its magic on resolving @site/ aliases

Weird 🤪 I can't make it work either

I guess it's fine to merge this for now and figure out why the site alias can't be in parent config

website/tsconfig.json Outdated Show resolved Hide resolved
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Aug 30, 2021
@slorber
Copy link
Collaborator

slorber commented Aug 30, 2021

Added yarn workspace website tsc to our test workflow, it should help catch those d.ts issues

We'll figure out the @site alias in another PR

Thanks 👍

@Josh-Cena
Copy link
Collaborator Author

Okay as long as tsc passes I'm fine 😏

@slorber slorber merged commit df3752c into facebook:main Aug 30, 2021
@Josh-Cena Josh-Cena deleted the ts-fix branch August 30, 2021 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants