stc
stc copied to clipboard
fix(ts/analyzer): Overload handling should handle constructor
Description:
I am not sure whether my fix is correct, so I am going to describe what I am doing here.
This MR is fixing #211. The original issue's proposed solution was to handle ClassMember::Constructor
in call_property_of_class()
. However, when I tried it out, it seems to never call the method.
So I retrace the error and found this, which seems to indicate that it actually does handle the constructor method correctly, and the root cause is that it didn't handle the generic type param T
properly:
Hence I set allow_assignment_to_param: true
to allow assigning T = 1
.
Related issue (if exists): #211
Oh yeah it's my bad. The handling logic should be added to extract
https://github.com/dudykr/stc/blob/805667830752f229f1674d034e1e9b0eb3fcb076/crates/stc_ts_file_analyzer/src/analyzer/expr/call_new.rs#L1215-L1647
@kdy1 I think it now excludes the module C2
. Lemme know if I am still doing something wrong...