File tree Expand file tree Collapse file tree 4 files changed +6
-22
lines changed Expand file tree Collapse file tree 4 files changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ export type ReplacementTarget = (
2222 statement : ts . Statement ;
2323 }
2424) & {
25- optional : boolean ;
2625 sourceFile : ts . SourceFile ;
2726} ;
2827
Original file line number Diff line number Diff line change @@ -138,14 +138,8 @@ function generateStatements(
138138 }
139139
140140 let lineInserted = false ;
141- for ( const target of replacementTargets . values ( ) ) {
142- for ( const statement of target ) {
143- if ( statement . optional ) {
144- // Since target from aliases may not be present in the original file,
145- // aliases that have not been consumed are skipped.
146- continue ;
147- }
148-
141+ for ( const [ name , targets ] of replacementTargets . entries ( ) ) {
142+ for ( const statement of targets ) {
149143 if ( ! lineInserted ) {
150144 result += "// --------------------\n" ;
151145 lineInserted = true ;
Original file line number Diff line number Diff line change @@ -42,24 +42,19 @@ export function loadAliasFile(
4242 const name = getStatementDeclName ( statement ) ?? "" ;
4343 const aliases = alias . get ( name ) ;
4444 if ( ! aliases ) {
45+ console . warn ( `Warning: No alias found for ${ name } ` ) ;
4546 return [ statement ] ;
4647 }
47- return aliases . map ( ( aliasDetails ) => {
48+ return aliases . flatMap ( ( aliasDetails ) => {
4849 if ( aliasDetails . file !== targetFileName ) {
49- return statement ;
50+ return [ ] ;
5051 }
51- return replaceAliases ( statement , aliasDetails . replacement ) ;
52+ return [ replaceAliases ( statement , aliasDetails . replacement ) ] ;
5253 } ) ;
5354 } ) ;
5455
5556 // Scan the target file
5657 const replacementMap = scanStatements ( printer , statements , aliasFile ) ;
57- // mark everything as optional
58- for ( const targets of replacementMap . values ( ) ) {
59- for ( const target of targets ) {
60- target . optional = true ;
61- }
62- }
6358
6459 return {
6560 replacementMap,
@@ -122,7 +117,6 @@ function scanStatements(
122117 type : "interface" ,
123118 members,
124119 originalStatement : transformedStatement ,
125- optional : false ,
126120 sourceFile : sourceFile ,
127121 } ) ;
128122 return targets ;
@@ -146,7 +140,6 @@ function scanStatements(
146140 sourceFile ,
147141 )
148142 : new Map ( ) ,
149- optional : false ,
150143 sourceFile : sourceFile ,
151144 } ) ;
152145 return targets ;
@@ -156,7 +149,6 @@ function scanStatements(
156149 statements . push ( {
157150 type : "non-interface" ,
158151 statement : transformedStatement ,
159- optional : false ,
160152 sourceFile : sourceFile ,
161153 } ) ;
162154 return statements ;
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ const es5TypedArrays = [
1919 "Uint32Array" ,
2020 "Float32Array" ,
2121 "Float64Array" ,
22- "Float16Array" ,
2322] ;
2423
2524const es2020TypedBigIntArrays = [ "BigInt64Array" , "BigUint64Array" ] ;
You can’t perform that action at this time.
0 commit comments