Skip to content

TypeScript 5.0 Support #6380

Closed
Closed
@bradzacher

Description

@bradzacher

https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-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.

✅ Decorators

We'll need to review the new decorators version to double check if there are any syntax differences.

From the looks of it we're missing support for at least this new valid syntax:

export
@decorator
class Bar {}

export default
@decorator
class Baz {}

const Type Parameters (#6600)

type HasNames = { names: readonly string[] };
function getNamesExactly<const T extends HasNames>(arg: T): T["names"] {
//                       ^^^^^
    return arg.names;
}

This will require AST changes

--verbatimModuleSyntax

This new flag doesn't actually impact us, but we will want to create a new lint rule to help people write "good" code with this flag on.

With the flag, this is the transpilation behaviour:

import {type A, type B} from 'mod';

// transpiled to

import {} from 'mod';
// which is the same as
import 'mod';

Based on discussions - it's clear that most people won't actually want this behaviour, so we'll want a lint rule that warns against import declarations that only contain inline type qualified specifiers.

#6382 has been raised separately to track this

✅ API Breaking Changes

We will need to audit our codebase for breakages and fix them as necessary.

lib.d.ts Updates

We will need to regenerate our types within scope-manager.


Other changes with no impact to us

  • Supporting Multiple Configuration Files in extends
  • All enums Are Union enums
  • --moduleResolution bundler
  • Resolution Customization Flags
    • allowImportingTsExtensions
    • resolvePackageJsonExports
    • resolvePackageJsonImports
    • allowArbitraryExtensions
    • customConditions
    • verbatimModuleSyntax
  • Support for export type *
    • This was already syntactically valid and thus our AST already supported this, marking this case as exportKind: 'type'. Previously it was a TS semantic error, and it is no more.
  • Support in JSDoc
    • @satisfies
    • @overload
  • Passing Emit-Specific Flags Under --build
  • Exhaustive switch/case Completions
  • Speed, Memory, and Package Size Optimizations
    • This might have implicit downstream wins for lint times.
  • Breaking Changes and Deprecations
    • Runtime Requirements
      • We already have minimum node v12, so we're good here.
    • API Breaking Changes
      • We will need to audit our codebase for breakages and fix them as necessary.
    • Forbidden Implicit Coercions in Relational Operators
    • Enum Overhaul
    • More Accurate Type-Checking for Parameter Decorators in Constructors Under --experimentalDecorators
    • Deprecations and Default Changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    ASTPRs and Issues about the AST structureNew TypeScript VersiondependenciesIssue about dependencies of the package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions