-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
TypeScript 4 upgrade #16101
Comments
I'd suggest slightly different approach: TL;DR:
Long version: 1. migrate TS to single version policy approach with the ability to opt out in any package (web-components only for now)
Remarks:
2 - migrate to 3.9.7
3 - setup
|
@Hotell This proposal could make sense overall, but there are a couple issues we'll need to deal with.
Agreed about this. The only single-version exception today should be with the web-components package (need to check with @chrisdholt before making any changes to its TS version).
We were blocked from going to 3.9 by a change it made to how certain exports were emitted which caused massive increases in bundle size for consumers. @dzearing do you remember the details of this issue? I'm unfortunately also not 100% clear on whether it's been fixed in 4.1, or whether we were just hoping it would be...
There are two parts to this from my perspective. We could potentially go ahead and add this tooling while still on 3.7, and the two pieces could be done separately and/or by different people.
Should clarify with @layershifter what promises v0 makes (if any) about TS version compatibility--it might not be an issue for them. I also think we probably don't need to enable downleveling (at least not down to 3.7) for the new converged packages.
I could go either way on this part, but I was leaning towards attempting to do the upgrade all at once first (partly in case of bugs in 4.0 which may be fixed in 4.1) and then going back to 4.0 only if we found problems with 4.1. |
that's fine for now and already applied in my PR. As described in my proposal (opt out). Future goal would be to get it unified for everyone (maintaining costs, etc mentioned in my proposal)
Yeah I can see that on CI report. that's unfortunate. would love to get link to TS repo with what's the cause.
Well my team and owner of those code parts should be responsible in particular sprint. (even better to pair with person/team that owns codebase which is having issues. From personal experience, I don't think the approach (Im gonna fix it all) works nor scales. There is ofc one exception to this (gradual + ts-expect-error pragma) - if that's public API -> that might mess up types. In errors that occured in my PR, no public apis are affected.
👍
Testing the compatibility would be more complicated than just importing all components and run Out off topic:
good idea 👍, lets do it like that
Right. I'd stick with gradual approach whenever possible (although TS 3.9 is apparently a no go step because of that increased bundle size - another good reason to use babel/esbuild for transpiling in convergence initiative). As I mentioned, "all at once" ends up usually with small chance getting merged in short period if at all, especially with typescript which doesn't follow semver. |
Minor update: I looked into whether upgrading to DetailsPer the tslib docs, the minimum typescript version to use Per the tslib 2.0.0 release notes the only breaking change in version 2 is:
Per this PR description:
From what I can tell (see this PR comment), the |
Update:
|
Ported from hackmd
Problem description
Typescript 3.7 which builds react and react-northstar in the currently in the fluent repo is just over a year old. The current version is 4.1 (released mid-November).
In order to stay current we should invest time to upgrade the repo to Typescript 4.1.
This also unblocks setting up project references across the repo (as a follow-up project), which will provide a greatly improved dev experience when working across multiple packages.
Appetite
This is something that needs to be done to stay current with typescript and encourage partners to also modernize their own infrastructure. Previous initiatives to improve build infrastructure in the repo such as introducing project references were blocked by typescript bugs and could be tried again once the repo is upgraded to 4.0+.
This project is a good candidate for tag-teaming between time zones: work in a shared branch, and at the end of the day push your current progress and leave some notes about status/questions/next steps.
Solution
The main objective of this project is relatively straightforward that we should bump the current typescript version in the repo and get passing builds in all projects.
@fluentui/react
has a hard constraint to maintain support for the typescript version for the latest release which for v8 is still 3.7.Once we manage to get passing builds with 4.1 we would need a validation process for older typesript versions and perhaps release a beta for a partner.
The validation steps at least should be
We could also investigate libraries such as the downlevel-dts package to integrate with our build scripts to guarantee some form of backwards compatibility for older typescript versions.
In addition to upgrading TS itself, we'll need to upgrade some of our build dependencies which are specific to particular TS versions. This will definitely be the case with API Extractor and possibly also
ts-jest
,ts-loader
, and maybe others.Risks
The uncertainty of what is required to complete the upgrade is risk. Typescript doesn't offer backwards compatibility or follow semantic versioning, so it's easy to accidentally break partners. It also tends to provide stricter type checking each release, which is a good thing overall, but can cause migration pain (especially with the size of our codebase and complexity of some types).
This project is difficult to fully scope ahead of time and could take either a few days or a few weeks. Previous work on typescript in the repo has shown as much.
For upgrading tooling within the repo itself, some of the risks are as follows:
Once we release, we may hear about additional issues from partners:
There is also a risk of an extended validation period required for partners who would need support for older versions. We should not revert any TS upgrade changes if support for anything less than minimum supported version is required (currently 3.7)
Since 4.1 is quite new, it's possible it has some bugs which haven't been discovered/reported yet. It's still worth trying 4.1 first, but if we encounter any difficult issues which don't repro in 4.0, going to 4.0 for now is an acceptable fallback. (We can't go lower due to a bug in 3.9 which would substantially increase partners' bundle sizes.)
Another thing that wasn't clear from the documentation is whether we'll need to upgrade all the projects'
tslib
dependency to version 2.Out of scope
The objective of this project is to replace typesript 3.7 with 4.1 and achieve backwards compatibility until 3.7 for dts files. All changes reflected should only contribute to this goal. Avoid making any other kind of build improvements until the upgrade is completed; any unnecessary changes could make this upgrade more painful.
The upgrade will be made in
master
only (not7.0
).The typescript version under
packages/web-components
should probably stay the same since it's managed separately.The text was updated successfully, but these errors were encountered: