- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
          Add target: "es2022"
          #46291
        
          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
          
     Merged
      
      
    
      
        
          +973
        
        
          −47
        
        
          
        
      
    
  
  
     Merged
                    
  
    Add target: "es2022"
  
  #46291
                      Changes from all commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      5b7da72
              
                Add `target: "es2022"`
              
              
                saschanaz 63a65d7
              
                Add Object.hasOwn
              
              
                saschanaz c940acb
              
                formatToParts is es2018
              
              
                saschanaz f28a433
              
                Merge remote-tracking branch 'upstream/main' into es2022
              
              
                saschanaz c341cd7
              
                ref update
              
              
                saschanaz e67d6e5
              
                optional parameter
              
              
                saschanaz f384243
              
                Revert "optional parameter"
              
              
                saschanaz 95b4ad8
              
                undefined
              
              
                saschanaz 5ebce82
              
                error cause
              
              
                saschanaz 2c91268
              
                Lint fix
              
              
                orta File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| interface Array<T> { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): T | undefined; | ||
| } | ||
|  | ||
| interface ReadonlyArray<T> { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): T | undefined; | ||
| } | ||
|  | ||
| interface Int8Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Uint8Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Uint8ClampedArray { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Int16Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Uint16Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Int32Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Uint32Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Float32Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface Float64Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface BigInt64Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | ||
|  | ||
| interface BigUint64Array { | ||
| /** | ||
| * Returns the item located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): number | undefined; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /// <reference lib="es2021" /> | ||
| /// <reference lib="es2022.array" /> | ||
| /// <reference lib="es2022.error" /> | ||
| /// <reference lib="es2022.object" /> | ||
| /// <reference lib="es2022.string" /> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| interface ErrorOptions { | ||
| cause?: Error; | ||
| } | ||
|  | ||
| interface ErrorConstructor { | ||
| new(message?: string, options?: ErrorOptions): Error; | ||
| (message?: string, options?: ErrorOptions): Error; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /// <reference lib="es2022" /> | ||
| /// <reference lib="dom" /> | ||
| /// <reference lib="webworker.importscripts" /> | ||
| /// <reference lib="scripthost" /> | ||
| /// <reference lib="dom.iterable" /> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| interface Object { | ||
| /** | ||
| * Determines whether an object has a property with the specified name. | ||
| * @param o An object. | ||
| * @param v A property name. | ||
| */ | ||
| hasOwn(o: object, v: PropertyKey): boolean; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| interface String { | ||
| /** | ||
| * Returns a new String consisting of the single UTF-16 code unit located at the specified index. | ||
| * @param index The zero-based index of the desired code unit. A negative index will count back from the last item. | ||
| */ | ||
| at(index: number): string | undefined; | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| /// <reference lib="es2021" /> | ||
| /// <reference lib="es2022" /> | ||
| /// <reference lib="esnext.intl" /> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            18 changes: 18 additions & 0 deletions
          
          18 
        
  tests/baselines/reference/callChainWithSuper(target=es2022).js
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| //// [callChainWithSuper.ts] | ||
| // GH#34952 | ||
| class Base { method?() {} } | ||
| class Derived extends Base { | ||
| method1() { return super.method?.(); } | ||
| method2() { return super["method"]?.(); } | ||
| } | ||
|  | ||
| //// [callChainWithSuper.js] | ||
| "use strict"; | ||
| // GH#34952 | ||
| class Base { | ||
| method() { } | ||
| } | ||
| class Derived extends Base { | ||
| method1() { return super.method?.(); } | ||
| method2() { return super["method"]?.(); } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            8 changes: 8 additions & 0 deletions
          
          8 
        
  tests/baselines/reference/errorCause(target=es2021).errors.txt
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| tests/cases/compiler/errorCause.ts(1,18): error TS2554: Expected 0-1 arguments, but got 2. | ||
|  | ||
|  | ||
| ==== tests/cases/compiler/errorCause.ts (1 errors) ==== | ||
| new Error("foo", { cause: new Error("bar") }); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| !!! error TS2554: Expected 0-1 arguments, but got 2. | ||
|  | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ES2022 does not contain new syntax, should we skip
ContainsES2022flag (or setContainsES2022=ContainsES2021) to save the bitflag?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are (notably class private fields), but just not here yet AFAIK.