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

TypeScript 4.5 Support #3950

Closed
8 tasks done
Tracked by #111 ...
bradzacher opened this issue Oct 3, 2021 · 11 comments
Closed
8 tasks done
Tracked by #111 ...

TypeScript 4.5 Support #3950

bradzacher opened this issue Oct 3, 2021 · 11 comments
Labels
accepting prs Go ahead, send a pull request that resolves this issue AST PRs and Issues about the AST structure dependencies Issue about dependencies of the package New TypeScript Version

Comments

@bradzacher
Copy link
Member

bradzacher commented Oct 3, 2021

https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-rc/

This issue is just to track all of the new features and their implementation state in this project.
As with all releases, we will not necessarily to support all features until closer to the full release when everything the features are stabilised.

Please be patient.

type Modifiers on Import and Export Names

import { someFunc, type BaseType } from "./some-module.js";
//                 ^^^^^^^^^^^^^

type T = 1;
export { type T };

This will require AST changes.

Babel: babel/babel#13802

This will require updates to scope analysis:

This will require updates to rules:

Private Field Presence Checks

class Person {
    #name: string;
    constructor(name: string) {
        this.#name = name;
    }

    equals(other: unknown) {
        return other &&
            typeof other === "object" &&
            #name in other &&
//          ^^^^^^^^^^^^^^
            this.#name === other.#name;
    }
}

This will require AST changes.

ESTree: https://github.com/estree/estree/blob/master/es2022.md#binaryexpression

Import Assertions

import obj from "./something.json" assert { type: "json" };

This will require AST changes.

ESTree: https://github.com/estree/estree/blob/master/stage3/import-assertions.md

lib.d.ts Changes

Will require regeneration of @typescript-eslint/scope-manager types.

Better Editor Support for Unresolved Types

This might break a few tests due to the type printer printing something that isn't any.


Other changes with no impact to us

  • Supporting lib from node_modules
  • The Awaited Type and Promise Improvements
  • Template String Types as Discriminants
  • --module es2022
  • Tail-Recursion Elimination on Conditional Types
  • Disabling Import Elision
  • Faster Load Time with realPathSync.native
  • New Snippet Completions
  • Better Editor Support for Unresolved Types
  • Inference Changes from Awaited
  • Compiler Options Checking at the Root of tsconfig.json
  • Restrictions on Assignability to Conditional Types
@bradzacher bradzacher added dependencies Issue about dependencies of the package AST PRs and Issues about the AST structure labels Oct 3, 2021
@Jamesernator

This comment has been minimized.

@bradzacher

This comment has been minimized.

@Jamesernator

This comment has been minimized.

@bradzacher bradzacher pinned this issue Oct 23, 2021
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@bradzacher
Copy link
Member Author

4.5rc has released
https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-rc/

@bradzacher
Copy link
Member Author

4.5 has officially released
https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/

@thetutlage

This comment has been minimized.

@bradzacher

This comment has been minimized.

@thetutlage

This comment has been minimized.

@bradzacher

This comment has been minimized.

@Josh-Cena
Copy link
Member

In terms of consistent-type-imports / consistent-type-exports — I'm most looking forward to these features and am willing to contribute if I have the bandwidth. Consider this:

import React, {ComponentType} from 'react';

I think it would just be autofixed as:

import React, {type ComponentType} from 'react';

Instead of the old way with two lines of import right? Should we also autofix those that were split into two lines to make this rule happy and merge them into one line?

@bradzacher
Copy link
Member Author

I think it would just be autofixed as ... Instead of the old way with two lines of import right?

I think that should be an option (default false), not the default for a few reasons:

  • not everyone will be on 4.5, so we don't want to use broken syntax.
    • could do version detection, but I think for now we should just not jump the gun for now so we don't have differing behaviours.
  • not everyone likes the inline syntax, and some people like to separate type imports from value imports.
  • the existing behaviour is to do non inline, so to change the style in a minor would be a breaking change.

Should we also autofix those that were split into two lines to make this rule happy and merge them into one line?

That would be the concern of a rule like no-duplicate-imports, not consistent-type-imports.

Happy to accept a PR to add an option to do that - please raise a separate issue for that so we can track it - it's an additional feature request and isn't required for 4.5 support so it isn't covered by this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue AST PRs and Issues about the AST structure dependencies Issue about dependencies of the package New TypeScript Version
Projects
None yet
Development

No branches or pull requests

5 participants