File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,16 @@ const vRegex = /v\.(\w+)\(/g;
4545 */
4646function ts ( strings : TemplateStringsArray , ...values : unknown [ ] ) : Check {
4747 const dedented = dedent ( strings , ...values ) ;
48- const usedImports = Array . from ( dedented . matchAll ( vRegex ) ) . map ( ( m ) => m [ 1 ] ) ;
49- const uniqueImports = Array . from ( new Set ( usedImports ) ) . map ( ( importName ) =>
48+ const usedImports = Array . from ( dedented . matchAll ( vRegex ) , ( [ , importName ] ) =>
49+ // if it's a reserved name, use the suffixed version
5050 importNames . has ( importName + '_' ) ? importName + '_' : importName
5151 ) ;
52+ const uniqueImports = new Set ( usedImports ) ;
5253 return {
5354 name : `\`\`\`ts\n${ dedented } \n\`\`\`` ,
5455 // ESM only
5556 path : paths [ 0 ] ,
56- import : `{ ${ uniqueImports . join ( ', ' ) } }` ,
57+ import : `{ ${ Array . from ( uniqueImports ) . join ( ', ' ) } }` ,
5758 } ;
5859}
5960
You can’t perform that action at this time.
0 commit comments