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

Upgrade to TypeScript 4.0 #8982

Merged
merged 11 commits into from
Aug 21, 2020
Merged

Conversation

sosukesuzuki
Copy link
Member

Closes #8646

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki
Copy link
Member Author

Oh, we should remove this warning.
スクリーンショット 2020-08-15 16 36 57

Comment on lines -17 to -22

// Invalid label 1
type T = [x.y: A];

// Invalid label 2
type T = [x<y>: A];
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep these two in typescript-babel-only

@fisker
Copy link
Member

fisker commented Aug 15, 2020

Oh, we should remove this warning.
スクリーンショット 2020-08-15 16 36 57

I think we should wait until typescript-eslint officially support v4

@sosukesuzuki sosukesuzuki mentioned this pull request Aug 15, 2020
10 tasks
@sosukesuzuki
Copy link
Member Author

sosukesuzuki commented Aug 19, 2020

Set loggerFn to false then it works fine.
スクリーンショット 2020-08-19 17 49 56

@sosukesuzuki sosukesuzuki marked this pull request as ready for review August 19, 2020 09:18
@sosukesuzuki
Copy link
Member Author

According to microsoft/TypeScript#38510, 4.0 will be released on 8/20, so let's wait.

@sosukesuzuki sosukesuzuki added this to the 2.1 milestone Aug 19, 2020
@72636c 72636c mentioned this pull request Aug 20, 2020
1 task
@petejkim
Copy link

Current version of prettier can't parse the new "Short-Circuiting Assignment Operators" syntax.

e.g.

foo ??= "default value"

@fisker
Copy link
Member

fisker commented Aug 21, 2020

Current version of prettier can't parse the new "Short-Circuiting Assignment Operators" syntax.

e.g.

foo ??= "default value"

@sosukesuzuki Can you check it's tested on typescript parser?

@brodybits
Copy link
Contributor

brodybits commented Aug 21, 2020

There will be lint:typecheck errors if you merge with master, due to recently merged PR #8759 (which I tried in my workarea):

  • duplicate identifiers from these lines:
    // WORKAROUND HACK for typescript-eslint issue:
    // https://github.com/typescript-eslint/typescript-eslint/issues/2388
    // MUST REMOVE to avoid errors with TypeScript 4.0.0:
    import * as ts from "typescript";
    declare module "typescript" {
    type NamedTupleMember = Node;
    }
  • type issues in src/language-js/utils.js

I really hope we don't have to revert anything major in master.

P.S. I did try typecheck with @typescript-eslint/types@4.0.0-alpha.12 which didn't solve any type issues.

@fisker
Copy link
Member

fisker commented Aug 21, 2020

I thought you applied this suggestion #8759 (comment), how to fix it?

@brodybits
Copy link
Contributor

You can just remove the workaround hack lines when you merge from master:

// WORKAROUND HACK for typescript-eslint issue:
// https://github.com/typescript-eslint/typescript-eslint/issues/2388
// MUST REMOVE to avoid errors with TypeScript 4.0.0:
import * as ts from "typescript";
declare module "typescript" {
type NamedTupleMember = Node;
}

You will also have to solve the type issues between src/language-js/utils.js and TypeScript 4. I think you will want do this before merging this PR into master. What a mess:)

@sosukesuzuki
Copy link
Member Author

You will also have to solve the type issues between src/language-js/utils.js and TypeScript 4. I think you will want do this before merging this PR into master. What a mess:)

@brodybits How to fix?

@brodybits
Copy link
Contributor

How to fix?

I proposed a quick workaround here: sosukesuzuki#2

This is using any parameter type in 3 places. I recall we discussed elsewhere (@thorn0?) that we should eventually search for any type specifiers and replace them with more specific types at some point in the future. But I would definitely not favor blocking TypeScript 4.0 update with this.

@brodybits
Copy link
Contributor

foo ??= "default value"

seems to be tested with Babel & TypeScript in tests/js/logical-assignment

@sosukesuzuki
Copy link
Member Author

Thank you. I agree with you. For now, let's merge it and consider a fix after the 2.1 release.

workaround for TypeScript 4.0 in src/language-js/utils.js
@fisker
Copy link
Member

fisker commented Aug 21, 2020

Let's merge!

@sosukesuzuki sosukesuzuki merged commit 751f67a into prettier:master Aug 21, 2020
@sosukesuzuki sosukesuzuki deleted the typescript-4.0 branch August 21, 2020 07:09
@sosukesuzuki
Copy link
Member Author

Should we add changelog for Short-Circuiting Assignment Operators?

@sosukesuzuki sosukesuzuki mentioned this pull request Aug 21, 2020
4 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support TypeScript 4.0
5 participants