File tree 4 files changed +6
-22
lines changed
4 files changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ export type ReplacementTarget = (
22
22
statement : ts . Statement ;
23
23
}
24
24
) & {
25
- optional : boolean ;
26
25
sourceFile : ts . SourceFile ;
27
26
} ;
28
27
Original file line number Diff line number Diff line change @@ -138,14 +138,8 @@ function generateStatements(
138
138
}
139
139
140
140
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 ) {
149
143
if ( ! lineInserted ) {
150
144
result += "// --------------------\n" ;
151
145
lineInserted = true ;
Original file line number Diff line number Diff line change @@ -42,24 +42,19 @@ export function loadAliasFile(
42
42
const name = getStatementDeclName ( statement ) ?? "" ;
43
43
const aliases = alias . get ( name ) ;
44
44
if ( ! aliases ) {
45
+ console . warn ( `Warning: No alias found for ${ name } ` ) ;
45
46
return [ statement ] ;
46
47
}
47
- return aliases . map ( ( aliasDetails ) => {
48
+ return aliases . flatMap ( ( aliasDetails ) => {
48
49
if ( aliasDetails . file !== targetFileName ) {
49
- return statement ;
50
+ return [ ] ;
50
51
}
51
- return replaceAliases ( statement , aliasDetails . replacement ) ;
52
+ return [ replaceAliases ( statement , aliasDetails . replacement ) ] ;
52
53
} ) ;
53
54
} ) ;
54
55
55
56
// Scan the target file
56
57
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
- }
63
58
64
59
return {
65
60
replacementMap,
@@ -122,7 +117,6 @@ function scanStatements(
122
117
type : "interface" ,
123
118
members,
124
119
originalStatement : transformedStatement ,
125
- optional : false ,
126
120
sourceFile : sourceFile ,
127
121
} ) ;
128
122
return targets ;
@@ -146,7 +140,6 @@ function scanStatements(
146
140
sourceFile ,
147
141
)
148
142
: new Map ( ) ,
149
- optional : false ,
150
143
sourceFile : sourceFile ,
151
144
} ) ;
152
145
return targets ;
@@ -156,7 +149,6 @@ function scanStatements(
156
149
statements . push ( {
157
150
type : "non-interface" ,
158
151
statement : transformedStatement ,
159
- optional : false ,
160
152
sourceFile : sourceFile ,
161
153
} ) ;
162
154
return statements ;
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ const es5TypedArrays = [
19
19
"Uint32Array" ,
20
20
"Float32Array" ,
21
21
"Float64Array" ,
22
- "Float16Array" ,
23
22
] ;
24
23
25
24
const es2020TypedBigIntArrays = [ "BigInt64Array" , "BigUint64Array" ] ;
You can’t perform that action at this time.
0 commit comments