minify-type-constructors shouldn’t rewrite `String(symbol)`
See original GitHub issueInput
var symbol = Symbol();
String(symbol);
// → 'Symbol()'
Current output:
var symbol = Symbol();
symbol+"";
// → throws TypeError: Cannot convert a Symbol value to a string
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Class renaming breaks certain patterns #510 - evanw/esbuild
When the esbuild bundler hits a conflicting class name it appends a number, which breaks the pattern. There are several potential ways to ......
Read more >TypeScript/JavaScript minification - Stack Overflow
Now, at some point in my code I do something like this: class Test { testProperty: any; constructor() { this.getMethods ...
Read more >API Reference - Terser
Assuming installation via NPM, you can load Terser in your application like this: const { minify } = require("terser");.
Read more >Documentation - tsc CLI Options - TypeScript
Flag Type Default
‑‑allowJs boolean false
‑‑allowUmdGlobalAccess boolean false
‑‑allowUnreachableCode boolean
Read more >Code Golfing Tips & Tricks: How to Minify your JavaScript Code
Note: Do not use in fast loops, because the milliseconds might not change! Strings. Prefer slice over substr over substring. Prefer slice(start, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note that
String(x)
andx + ""
(or"" + x
) are not equivalent in general. Here’s another snippet that doesn’t use symbols but still produces different output after minification:Another example:
Here’s a more elaborate example:
This is merged and now there is an option to disable only
String()
type constructors.