Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 4eecbee

Browse files
committed
fix: rollback to union_type
1 parent e18fa09 commit 4eecbee

File tree

1 file changed

+39
-0
lines changed
  • crates/stc_ts_file_analyzer/src/analyzer/types

1 file changed

+39
-0
lines changed

crates/stc_ts_file_analyzer/src/analyzer/types/mod.rs

+39
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,39 @@ impl Analyzer<'_, '_> {
115115
body,
116116
metadata: InterfaceMetadata { common },
117117
}) => {
118+
// for extend in extends {
119+
// for type_arg in extend.to_owned().type_args {
120+
// for param in type_arg.params {
121+
// match param {
122+
// Type::Array(_) => return Ok(Cow::Owned(param)),
123+
// Type::Union(Union { span, types, metadata }) => {
124+
// for ty in types {
125+
// match ty {
126+
// Type::Array(_) => {
127+
// println!("{ty:#?}");
128+
// return Ok(Cow::Owned(ty));
129+
// }
130+
// _ => {
131+
// // println!("{ty:#?}");
132+
// }
133+
// }
134+
// }
135+
// }
136+
// _ => {}
137+
// }
138+
// }
139+
// }
140+
// }
141+
118142
for extend in extends {
119143
let types = extend.to_owned().type_args.into_iter().flat_map(|cur| cur.params);
144+
// let elems = types
145+
// .map(|ty| TupleElement {
146+
// span: *span,
147+
// label: None,
148+
// ty: box ty,
149+
// })
150+
// .collect();
120151
let union_type = Type::new_union(*span, types);
121152
if let box RExpr::Ident(ident) = &extend.expr {
122153
let RIdent {
@@ -126,8 +157,16 @@ impl Analyzer<'_, '_> {
126157
optional,
127158
} = ident;
128159
if sym == &js_word!("Array") {
160+
// println!("{span:#?}\n{union_type:#?}");
161+
// return Ok(Cow::Owned(Type::Tuple(Tuple {
162+
// span: *span,
163+
// elems,
164+
// metadata: TupleMetadata { common: *common },
165+
// })));
129166
return Ok(Cow::Owned(Type::Array(Array {
130167
span: *span,
168+
// elem_type: box Type::any(*span,
169+
// KeywordTypeMetadata { common: *common }),
131170
elem_type: box union_type,
132171
metadata: Default::default(),
133172
})));

0 commit comments

Comments
 (0)