stc icon indicating copy to clipboard operation
stc copied to clipboard

fix(ts/analyzer): Overload handling should handle constructor

Open yamgent opened this issue 2 years ago • 3 comments

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:

stc-211-error-highlight

Hence I set allow_assignment_to_param: true to allow assigning T = 1.

Related issue (if exists): #211

yamgent avatar Nov 06 '22 06:11 yamgent

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 06 '22 06:11 CLAassistant

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 avatar Nov 06 '22 06:11 kdy1

@kdy1 I think it now excludes the module C2. Lemme know if I am still doing something wrong...

yamgent avatar Nov 07 '22 14:11 yamgent