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.3 Syntax Support #3272

Closed
bradzacher opened this issue Apr 7, 2021 · 6 comments
Closed

TypeScript 4.3 Syntax Support #3272

bradzacher opened this issue Apr 7, 2021 · 6 comments
Labels
AST PRs and Issues about the AST structure New TypeScript Version package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Milestone

Comments

@bradzacher
Copy link
Member

bradzacher commented Apr 7, 2021

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


Separate Write Types on Properties (Supported: #3427)

interface Thing {
    get size(): number
    set size(value: number | string | boolean);
}

This will require AST changes.

override and the --noImplicitOverride Flag (Supported: #3429)

class SpecializedComponent extends SomeComponent {
    override show() {
        // ...
    }
    override hide() {
        // ...
    }
}

This will require AST changes.

ECMAScript #private Class Elements (NOT YET Supported: #3430)

class Foo {
    #someMethod() {
        //...
    }

    get #someValue() {
        return 100;
    }

    static #someStaticMethod() {
        // ...
    }
}

Private names are still waiting to be fully implemented (See #1436).
This will require AST changes.

static Index Signatures

class Foo {
    static hello = "hello";
    static world = 1234;

    static [propName: string]: string | number | undefined;
}

This is already supported!!

Other changes with no AST impact to us

  • ConstructorParameters Works on Abstract Classes
  • Contextual Narrowing for Generics
  • Always-Truthy Promise Checks
    • This means TS natively handles one of the use-cases of no-misused-promises!
  • .tsbuildinfo Size Improvements
  • Lazier Calculations in --incremental and --watch Compilations
  • Import Statement Completions
  • Editor Support for @link Tags
  • Go-to-Definition on Non-JavaScript File Paths
  • lib.d.ts Changes
  • Union Enums Cannot Be Compared to Arbitrary Numbers
@bradzacher bradzacher added package: typescript-estree Issues related to @typescript-eslint/typescript-estree AST PRs and Issues about the AST structure labels Apr 7, 2021
@bradzacher bradzacher added this to the 5.0.0 milestone Apr 7, 2021
@0kku
Copy link

0kku commented May 8, 2021

Trying to add "noImplicitOverride": true, to my tsconfig and then running eslint src causes it to use 2GB+ memory for a while and then crash with
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory with no indication of what caused it. Took me a while to figure out that it was caused by ESLint not supporting the flag. A clearer error message would be nice when encountering unrecognized compiler flags.

@bradzacher
Copy link
Member Author

I mean... When you installed the new TS version you would have gotten a warning from your package manager that it wasn't supported.

And then when you ran the linter you would have gotten a message saying that it wasn't supported, unless you disabled the messages.

@0kku
Copy link

0kku commented May 8, 2021

The linter gave no such message, it just crashed with no output:

> eslint src


<--- Last few GCs --->

[17500:000001DF2FC237E0]    35164 ms: Scavenge 2026.7 (2071.8) -> 2021.9 (2072.8) MB, 10.5 / 0.1 ms  (average mu = 0.710, current mu = 0.408) allocation failure
[17500:000001DF2FC237E0]    35253 ms: Scavenge 2028.1 (2072.8) -> 2025.0 (2075.5) MB, 14.7 / 0.0 ms  (average mu = 0.710, current mu = 0.408) allocation failure
[17500:000001DF2FC237E0]    35435 ms: Scavenge 2030.6 (2075.5) -> 2028.4 (2094.8) MB, 73.5 / 0.0 ms  (average mu = 0.710, current mu = 0.408) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
 1: 00007FF75A2F760F v8::internal::Isolate::ArchiveSpacePerThread+4719
 2: 00007FF75A28A756 SSL_get_quiet_shutdown+67206
 3: 00007FF75A28B656 node::OnFatalError+294
 4: 00007FF75AB91C1E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF75AB7620D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF75AA0EFCC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
 7: 00007FF75A9F9E3D v8::internal::NativeContextInferrer::Infer+59677
 8: 00007FF75A9DE8FF v8::internal::MarkingWorklists::Local::SwitchToContextSlow+60239
 9: 00007FF75A9F2C01 v8::internal::NativeContextInferrer::Infer+30433
10: 00007FF75A9E9DCD v8::internal::MarkCompactCollector::EnsureSweepingCompleted+6285
11: 00007FF75A9F1D2E v8::internal::NativeContextInferrer::Infer+26638
12: 00007FF75A9F603B v8::internal::NativeContextInferrer::Infer+43803
13: 00007FF75AA000D2 v8::internal::ItemParallelJob::Task::RunInternal+18
14: 00007FF75AA00061 v8::internal::ItemParallelJob::Run+641
15: 00007FF75A9D211D v8::internal::MarkingWorklists::Local::SwitchToContextSlow+9069
16: 00007FF75A9EA36E v8::internal::MarkCompactCollector::EnsureSweepingCompleted+7726
17: 00007FF75A9E8AB4 v8::internal::MarkCompactCollector::EnsureSweepingCompleted+1396
18: 00007FF75A9E61B8 v8::internal::MarkingWorklists::Local::SwitchToContextSlow+91144
19: 00007FF75AA14E51 v8::internal::Heap::LeftTrimFixedArray+945
21: 00007FF75AA0C1F1 v8::internal::Heap::CollectGarbage+1969
22: 00007FF75AA0A485 v8::internal::Heap::AllocateExternalBackingStore+1493
23: 00007FF75AA25C6F v8::internal::Factory::AllocateRaw+175
24: 00007FF75AA3B9EB v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString+75
25: 00007FF75AA32B2C v8::internal::Factory::NewProperSubString+332
26: 00007FF75A72B6A2 v8::internal::DeclarationScope::was_lazily_parsed+30546
27: 00007FF75AC18F3D v8::internal::SetupIsolateDelegate::SetupHeap+456749
28: 00007FF75AC0B115 v8::internal::SetupIsolateDelegate::SetupHeap+399877
29: 000002744A1081DA
>

I don't know what I've done wrong to not get the behavior you've described 🤷‍♂️

@bradzacher
Copy link
Member Author

The linter gave no such message, it just crashed with no output

unless you disabled the messages

The first thing our parser does before it even invokes TS is warn about the TS version - unless you've disabled this message in your config.

https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionswarnonunsupportedtypescriptversion

For example - this is the output of a fresh install with no parser options configured:

$ yarn add typescript@4.3.0-beta
success Saved 1 new dependency.
info All dependencies
└─ typescript@4.3.0-beta
Done in 9.58s.


$ yarn eslint .
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.3.0

YOUR TYPESCRIPT VERSION: 4.3.0-beta

Please only submit bug reports when using the officially supported version.

=============

Regardless though - you're saying you installed a beta version (not even RC) of typescript and assumed it'd just be supported by all tools, and are annoyed that the project didn't loudly enough warn you that you might be doing something unsupported?

It's not like we hide our supported ranges:
https://github.com/typescript-eslint/typescript-eslint#supported-typescript-version

@bradzacher bradzacher pinned this issue May 8, 2021
@sosukesuzuki
Copy link
Contributor

Separate Write Types on Properties

will require AST changes? It introduces the syntax like below:

interface Thing {
    get size(): number
    set size(value: number | string | boolean);
}

@bradzacher
Copy link
Member Author

Ahh I missed the bit about the interface signatures. Yes that will require AST changes

bradzacher added a commit that referenced this issue May 22, 2021
bradzacher added a commit that referenced this issue May 22, 2021
bradzacher added a commit that referenced this issue May 22, 2021
bradzacher added a commit that referenced this issue May 22, 2021
…types (#3427)

* chore: update typescript to 4.3-rc

Ref #3272

* feat(typescript-estree): add support for getter/setter signatures on types

Ref #3272
@bradzacher bradzacher unpinned this issue May 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2021
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 New TypeScript Version package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

No branches or pull requests

3 participants