[draft] Upgrade TS to 4.5.x, fix some of the broken tests #192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I'm working with a codebase that heavily uses the
import { type A } from '...';
syntax that is currently broken (see issue 185). So I'm trying to update the version of TS used in flowgen to latest, stopping at4.5.x
first for simplicity's sake.It's quite a bit more involved than I expected. Actually fixing the import type syntax was trivial, but it turns out that sometime between TS 4.4 and 4.5 there was a bugfix for the
getSymbolAtLocation()
function that causes it to return symbols in several situations where previously it would simply returnnull
. You can see this easily by selectingAlbumLabel
on line 3 of this TS AST viewer and changing the TS version used to generate it underOptions
: under 4.4 theSymbol
is shown asNone
in the right-hand column, but it's correctly identified in 4.5 and newer. I haven't been able to figure out exactly under what circumstances the behavior changed. I looked through the git history of the TS repo but couldn't find any commits that mentioned that function at all, and the only evidence I could find of it online were this old, unresolved bug report and this SO question.Several parts of flowgen seem to implicitly rely on this buggy behavior, and will emit incorrect Flow defs when TS returns non-null. I've been able to guess my way into "fixing" one or two instances of this, but I'm not convinced what I did was actually correct. I think some parts of flowgen might require nontrivial rewrites to work with the new behavior, but I don't know enough about flowgen to say for sure. Does anyone have any suggestions as to what I can try next?