swc/.changeset/honest-cooks-dream.md
CPunisher 4436621564
fix(es/minifier): Check type of assignment target before merging assignments (#9617)
**Description:**

Collect types of vars, maybe other optimization could benefit from this:
`merged_var_type: Option<Value<Type>>`

When the variable is reassigned, the we merge the types with some simple
rules:
`None` + `None` = `None`
`None` + `Some(ty)` = `Some(ty)`
`Some(ty1)` + `Some(ty2)` if `ty1` == `ty2` = `Some(ty1)`
Otherwise = Unknown

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/8718
2024-10-14 09:55:53 +09:00

164 B

swc_ecma_minifier swc_ecma_utils swc_ecma_usage_analyzer
patch patch patch

fix(es/minifier): Check type of assignment target before merging assignments