File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @sv443-network/userutils " : patch
3+ ---
4+
5+ Fix ` can't convert trArgs[0] to string ` error
Original file line number Diff line number Diff line change @@ -388,8 +388,16 @@ const templateLiteralTransform: TransformTuple<string> = [
388388 }
389389 } ;
390390
391+ let notStringifiable = false ;
392+ try {
393+ String ( trArgs [ 0 ] ) ;
394+ }
395+ catch {
396+ notStringifiable = true ;
397+ }
398+
391399 /** Whether the first args parameter is an object that doesn't implement a custom `toString` method */
392- const isArgsObject = trArgs [ 0 ] && typeof trArgs [ 0 ] === "object" && trArgs [ 0 ] !== null && String ( trArgs [ 0 ] ) . startsWith ( "[object" ) ;
400+ const isArgsObject = trArgs [ 0 ] && typeof trArgs [ 0 ] === "object" && trArgs [ 0 ] !== null && ( notStringifiable || String ( trArgs [ 0 ] ) . startsWith ( "[object" ) ) ;
393401
394402 if ( isArgsObject && eachKeyInTrString ( Object . keys ( trArgs [ 0 ] ! ) ) )
395403 namedMapping ( ) ;
You can’t perform that action at this time.
0 commit comments