Skip to content

fix: fix a few TS errors#5437

Merged
slorber merged 8 commits intofacebook:mainfrom
Josh-Cena:ts-fix
Aug 30, 2021
Merged

fix: fix a few TS errors#5437
slorber merged 8 commits intofacebook:mainfrom
Josh-Cena:ts-fix

Conversation

@Josh-Cena
Copy link
Copy Markdown
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
Copy Markdown

netlify Bot commented Aug 28, 2021

@github-actions
Copy link
Copy Markdown

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 <[email protected]>
Signed-off-by: Josh-Cena <[email protected]>
Signed-off-by: Josh-Cena <[email protected]>
@Josh-Cena
Copy link
Copy Markdown
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 <[email protected]>
Signed-off-by: Josh-Cena <[email protected]>
Copy link
Copy Markdown
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

Comment thread packages/docusaurus-init/templates/classic-typescript/tsconfig.json Outdated
Comment thread website/tsconfig.json Outdated
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Aug 30, 2021
@slorber
Copy link
Copy Markdown
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
Copy Markdown
Collaborator Author

Okay as long as tsc passes I'm fine 😏

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