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 deprecations, improve messaging #52993

Merged
merged 11 commits into from Mar 7, 2023

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Feb 27, 2023

As noted in #52975, things don't appear to be working as expected.

This PR makes it so that for every set of deprecated values, there is:

  • The version in which the option became deprecated.
  • The version in which the option has been removed.

If the current version is greater than or equal to the version in which the option was removed, then you get an error saying that the option has been removed and must be removed from tsconfig.json.

Otherwise, if the ignoreDeprecation option is not greater than or equal to the version in which the option became deprecated, then we'll issue an error saying to set ignoreDeprecation to at least the version that allows there to be no errors.

Along the way:

  • Make it so that we don't say "flag"; not all of these are flags.
  • Make it so that if we are deprecating a specific value, we don't say "Flag ES3" or "Option ES3", but instead something like Option 'target=ES3'.

What changes in this PR in baselines is all messages, however, one test includes what happens if the version is 6.0; I think the new behavior is fine. There's nothing special about 6.0 compared to 5.5.

src/compiler/program.ts Outdated Show resolved Hide resolved
@jakebailey
Copy link
Member Author

This likely needs to be backported to 5.0, otherwise it will break if we introduce any other deprecations.

@jakebailey
Copy link
Member Author

(but, I have a small refractor to apply before doing so)

}
else if (reportInvalidIgnoreDeprecations) {
createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations);
const parsed = Version.tryParse(ignoreDeprecations);
Copy link
Member Author

Choose a reason for hiding this comment

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

We talked about this and it seems like the intent is that we are not going to deprecate anything between TS 5.0 and TS 6.0, so this is overkill, and we can just write === "5.0" and error.

@jakebailey jakebailey added this to the TypeScript 5.0.2 milestone Mar 2, 2023
@jakebailey jakebailey merged commit 868331f into microsoft:main Mar 7, 2023
18 checks passed
@jakebailey jakebailey deleted the fix-deprecations branch March 7, 2023 17:39
@jakebailey
Copy link
Member Author

@typescript-bot cherry-pick this to release-5.0

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 7, 2023

Heya @jakebailey, I've started to run the task to cherry-pick this into release-5.0 on this PR at 7a25525. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into release-5.0 manually.

@jakebailey
Copy link
Member Author

figures

jakebailey added a commit to jakebailey/TypeScript that referenced this pull request Mar 7, 2023
DanielRosenwasser pushed a commit that referenced this pull request Mar 10, 2023
drivron pushed a commit to scenari/typescript that referenced this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants