Skip to content

Commit

Permalink
Remove wrong code
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 27, 2023
1 parent e1c0b51 commit 4867ef2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crates/stc_ts_file_analyzer/src/analyzer/assign/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,35 @@ impl Analyzer<'_, '_> {

_ => {}
};
let l_els = l
.def
.body
.iter()
.filter_map(|m| self.make_type_el_from_class_member(m, false))
.collect_vec();

self.assign_to_type_elements(
data,
l.span,
&l_els,
&r,
TypeLitMetadata {
specified: true,
..Default::default()
},
AssignOpts {
allow_unknown_rhs: Some(true),
is_assigning_to_class_members: true,
report_assign_failure_for_missing_properties: opts.report_assign_failure_for_missing_properties.or_else(|| {
Some(match r.normalize() {
Type::Interface(r) => !r.extends.is_empty(),
_ => false,
})
}),
..opts
},
)
.context("tried to assign to type elements created from a class instance")?;

// Everything left is assignable to empty classes, including classes with only
// constructors.
Expand Down

0 comments on commit 4867ef2

Please sign in to comment.