Skip to content

Commit

Permalink
reduce nonsensical code
Browse files Browse the repository at this point in the history
  • Loading branch information
sunrabbit123 committed Sep 22, 2023
1 parent 746b3ec commit ed42972
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions crates/stc_ts_file_analyzer/src/analyzer/types/intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,23 +445,14 @@ impl Analyzer<'_, '_> {
for prev in property_types.iter_mut() {
if let TypeElement::Property(prev) = prev {
if prev.key.type_eq(&p.key) {
let prev_type = prev
.type_ann
.clone()
.map(|v| *v)
.unwrap_or_else(|| Type::any(span, KeywordTypeMetadata { ..Default::default() }));
let other = p
.type_ann
.clone()
.map(|v| *v)
.unwrap_or_else(|| Type::any(span, KeywordTypeMetadata { ..Default::default() }));

let new = self.normalize_intersection_types(span, &[prev_type, other], opts)?;

if let Some(new) = new {
let prev_type = prev.type_ann.clone().map(|v| *v).unwrap_or(Type::any(span, Default::default()));
let other = p.type_ann.clone().map(|v| *v).unwrap_or(Type::any(span, Default::default()));

if let Some(new) = self.normalize_intersection_types(span, &[prev_type, other], opts)? {
if new.is_never() {
return never!();
}

prev.type_ann = Some(Box::new(new));
continue 'outer;
}
Expand Down

0 comments on commit ed42972

Please sign in to comment.