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
deps: update to typescript 4.7 #14058
Conversation
@@ -57,8 +57,8 @@ export class SwapLocaleFeature { | |||
const optionLocaleDisplay = new Intl.DisplayNames([locale], {type: 'language'}); | |||
|
|||
const optionLocaleName = optionLocaleDisplay.of(locale); | |||
const currentLocaleName = currentLocaleDisplay.of(locale); | |||
if (optionLocaleName !== currentLocaleName) { | |||
const currentLocaleName = currentLocaleDisplay.of(locale) || locale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was the only new "error". new Intl.DisplayNames().of()
can return undefined
, and optionEl.textContent
is supposed to only take string|null
, so that was the incompatibility.
In reality, I believe new Intl.DisplayNames
only returns null if fallback: 'none'
is set, otherwise it always falls back to locale
, so this fallback is mostly for tsc's sake, and just in case I'm reading the spec wrong.
tsconfig-base.json
Outdated
"outDir": "./.tmp/tsbuildinfo/", | ||
"rootDir": ".", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at the outDir
s in all the tsconfigs recently and was kind of annoyed, but it turns out if I had just looked at the rootDir
docs I would have realized it only affects emit, not includes
, excludes
, etc, so specifying this once in the base tsconfig works perfectly. Makes the extending tsconfigs much nicer, and should fix your problem in c55da8b, @connorjclark
@@ -1,8 +1,6 @@ | |||
{ | |||
"extends": "../tsconfig-base.json", | |||
"compilerOptions": { | |||
"outDir": "../../.tmp/tsbuildinfo/shared/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking the diff on the outDir
also revealed a minor bug here: this one was saving one directory too high. Check the parent directory of your lighthouse repo and there will be a .tmp
in there, too. Sorry :)
tsconfig-base.json
Outdated
"emitDeclarationOnly": true, | ||
"declarationMap": true, | ||
"outDir": "./.tmp/tsbuildinfo/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: i'm recently of the opinion that leading ./
in paths are pointless noise. if a path is not starting with /
I know it is relative :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really care, it just bothers me that rootDir: ''
isn't the identity instead of '.'
in this case, since they're right next to each other :)
I also took a second look at this workaround for the flow report: lighthouse/build/build-report.js Lines 72 to 80 in 94b4f38
with the latest version of @rollup/plugin-typescript, you can get away with removing the To really fix it we probably just need it to get closer to a real build tsconfig, and having those emitDeclarationOnly for js files in there is kind of confusing. Alternatively we could just build it ourselves to a tmp directory and run rollup on the output there. |
typescript 4.6 and typescript 4.7 have been released since we last updated, so it seemed time to update.
Unlike most updates, we only had a single new error that we needed to fix, and there's nothing new that our code could really benefit from, so it's a pretty simple update. There are some nice updates in typescript 4.6 that people may want to take advantage of (like still being able to discriminate between objects in a union even after the objects are destructured), and typescript 4.7 should make us more resilient in the future if more dependencies start doing complicated package.json
exports
.We can wait to land this for
typescript-eslint
to officially support 4.7 so we don't get the version warning inyarn lint
, but that should be today or tomorrow.