@@ -65,6 +65,36 @@ declare namespace AmbientStuff {
6565
6666 import FineAlias = EnumInAmbientContext . B ;
6767}
68+
69+ // Not erasable
70+ ( ( ) => < any > { } )();
71+ (()=> < any > { } )();
72+ (()=> < any > { } )();
73+
74+ // Erasable
75+ (()=> < any > ({ } ))();
76+ (()=> ( < any > { } ))();
77+ < any > { } ;
78+
79+
80+ // return and yield ASI
81+ function *gen() {
82+ yield < any >
83+ 1;
84+ return < any >
85+ 1;
86+ }
87+
88+ // at the start of an ExpressionStatement if followed by an object literal; though I'm not sure why one would use it there
89+ < unknown > { foo ( ) { } } .foo();
90+
91+ // at the start of an ExpressionStatement if followed by function keyword
92+ < unknown > function() { } ();
93+ < unknown > function() { } ;
94+
95+ // at the start of an ExpressionStatement if followed by an anonymous class expression
96+ // note that this exact syntax currently emits invalid JS (no parenthesis added like for function above)
97+ < unknown > class { }
6898
6999//// [commonjs.cts]
70100import foo = require("./other.cjs");
@@ -82,6 +112,33 @@ export default foo;
82112
83113
84114//// [index.js]
115+ var __generator = (this && this . __generator ) || function ( thisArg , body ) {
116+ var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g = Object . create ( ( typeof Iterator === "function" ? Iterator : Object ) . prototype ) ;
117+ return g . next = verb ( 0 ) , g [ "throw" ] = verb ( 1 ) , g [ "return" ] = verb ( 2 ) , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
118+ function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
119+ function step ( op ) {
120+ if ( f ) throw new TypeError ( "Generator is already executing." ) ;
121+ while ( g && ( g = 0 , op [ 0 ] && ( _ = 0 ) ) , _ ) try {
122+ if ( f = 1 , y && ( t = op [ 0 ] & 2 ? y [ "return" ] : op [ 0 ] ? y [ "throw" ] || ( ( t = y [ "return" ] ) && t . call ( y ) , 0 ) : y . next ) && ! ( t = t . call ( y , op [ 1 ] ) ) . done ) return t ;
123+ if ( y = 0 , t ) op = [ op [ 0 ] & 2 , t . value ] ;
124+ switch ( op [ 0 ] ) {
125+ case 0 : case 1 : t = op ; break ;
126+ case 4 : _ . label ++ ; return { value : op [ 1 ] , done : false } ;
127+ case 5 : _ . label ++ ; y = op [ 1 ] ; op = [ 0 ] ; continue ;
128+ case 7 : op = _ . ops . pop ( ) ; _ . trys . pop ( ) ; continue ;
129+ default :
130+ if ( ! ( t = _ . trys , t = t . length > 0 && t [ t . length - 1 ] ) && ( op [ 0 ] === 6 || op [ 0 ] === 2 ) ) { _ = 0 ; continue ; }
131+ if ( op [ 0 ] === 3 && ( ! t || ( op [ 1 ] > t [ 0 ] && op [ 1 ] < t [ 3 ] ) ) ) { _ . label = op [ 1 ] ; break ; }
132+ if ( op [ 0 ] === 6 && _ . label < t [ 1 ] ) { _ . label = t [ 1 ] ; t = op ; break ; }
133+ if ( t && _ . label < t [ 2 ] ) { _ . label = t [ 2 ] ; _ . ops . push ( op ) ; break ; }
134+ if ( t [ 2 ] ) _ . ops . pop ( ) ;
135+ _ . trys . pop ( ) ; continue ;
136+ }
137+ op = body . call ( thisArg , _ ) ;
138+ } catch ( e ) { op = [ 6 , e ] ; y = 0 ; } finally { f = t = 0 ; }
139+ if ( op [ 0 ] & 5 ) throw op [ 1 ] ; return { value : op [ 0 ] ? op [ 1 ] : void 0 , done : true } ;
140+ }
141+ } ;
85142var MyClassErr = /** @class */ (function () {
86143 // No parameter properties
87144 function MyClassErr ( foo ) {
@@ -120,6 +177,37 @@ var MyClassOk = /** @class */ (function () {
120177 }
121178 return MyClassOk ;
122179} ());
180+ // Not erasable
181+ (function () { return ( { } ) ; } )();
182+ (function () { return ( { } ) ; } )();
183+ (function () { return ( { } ) ; } )();
184+ // Erasable
185+ (function () { return ( { } ) ; } )();
186+ (function () { return ( { } ) ; } )();
187+ ({ } );
188+ // return and yield ASI
189+ function gen() {
190+ return __generator ( this , function ( _a ) {
191+ switch ( _a . label ) {
192+ case 0 : return [ 4 /*yield*/ , 1 ] ;
193+ case 1 :
194+ _a . sent ( ) ;
195+ return [ 2 /*return*/ , 1 ] ;
196+ }
197+ } ) ;
198+ }
199+ // at the start of an ExpressionStatement if followed by an object literal; though I'm not sure why one would use it there
200+ ({ foo : function ( ) { } } .foo());
201+ // at the start of an ExpressionStatement if followed by function keyword
202+ (function () { } )();
203+ (function () { } );
204+ // at the start of an ExpressionStatement if followed by an anonymous class expression
205+ // note that this exact syntax currently emits invalid JS (no parenthesis added like for function above)
206+ /** @class */ (function () {
207+ function class_1 ( ) {
208+ }
209+ return class_1 ;
210+ } ());
123211//// [commonjs.cjs]
124212"use strict";
125213var foo = require("./other.cjs");
0 commit comments