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 5.0 Support #6380

Closed
bradzacher opened this issue Jan 27, 2023 · 7 comments · Fixed by #6612
Closed

TypeScript 5.0 Support #6380

bradzacher opened this issue Jan 27, 2023 · 7 comments · Fixed by #6612
Labels
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 Jan 27, 2023

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
@Jack-Works
Copy link

Jack-Works commented Jan 30, 2023

After upgrading to ts 5.0-beta, I found this error:

This rule requires the strictNullChecks compiler option to be turned on to function correctly

Is there some breaks in the config parsing? We use "extends" to inherit strict flag from shared config.

Update: I found it still happens even if I'm not updating TypeScript, only eslint stuff.

@bradzacher
Copy link
Member Author

@Jack-Works https://typescript-eslint.io/maintenance/versioning#typescript
We do not officially support the beta versions, so we have not yet tested our code against the beta.

If something has broken, then that's probably due to an undocumented change in their release, which we'll address before the full 5.0 release.

@bcowgill
Copy link

I'm not sure about "no impact on us" for "bundler" --moduleResolution setting.

I got this error
swcpack.config.js
0:0 error Parsing error: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'

After adding the suggested configuration setting for typescript:
parserOptions: {
project: true,
},
from https://typescript-eslint.io/linting/typed-linting
I set project: false and omitted
// 'plugin:@typescript-eslint/recommended-requiring-type-checking'

@bradzacher
Copy link
Member Author

@bcowgill please read my previous comment.
#6380 (comment)

@bradzacher
Copy link
Member Author

@sosukesuzuki
Copy link
Contributor

@bradzacher @JoshuaKGoldberg Are you planning to work on this soon? If you are busy, can I work on this?

@bradzacher
Copy link
Member Author

@sosukesuzuki feel free to raise PRs!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AST PRs and Issues about the AST structure dependencies Issue about dependencies of the package New TypeScript Version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants