Closed robert-boulanger closed 2 years ago
Addendum:
Anyhow, when in an other class or module (even if it is in a different file)
ClassTest.test2 (the string) is assigned to a var which was a number before, the error is shown correctly.
example referencing the code block above
import {ClassTest2} from "..."
ct2 = new ClassTest2("tada",2,{})
x=0
x=ct2.test2
would cause an error in Coffeesense, which is correct
pointing the mouse over
@myA
in constructor :@myA
is shown as any => incorrect
It's correct, as this is also exactly what tsserver tells you in a JavaScript file:
It even kind of makes sense, as at that point in time,
this.myA
wasn't born yet
And as long as
x = new ClassTest2 'a', 1, {}
x.myA # <-- cursor pos
correctly gives you accurate autocomplete info about myA
being string
, I think it's fine.
pointing the mouse over
this.myB
in constructor :this.myB
is shown as any => incorrect pointing the mouse over@test
in constructor :@test
is shown as any => incorrect pointing the mouse overthis.test2
in constructor :this.test2
is shown as any => incorrect
same thing as above
so I'd say everything works as expected
It even kind of makes sense, as at that point in time, this.myA wasn't born yet And as long as
´´´coffeescript x = new ClassTest2 'a', 1, {} x.myA # <-- cursor pos ´´´
correctly gives you accurate autocomplete info about myA being string, I think it's fine.
I agree, the important thing is, that the error is shown in the latter case and the autocomplete info is correct.
Given the following class:
pointing the mouse over @myA in constructor : @myA is shown as any => incorrect pointing the mouse over A (right from equal sign) in constructor : A is shown as string => correct pointing the mouse over this.myB in constructor : this.myB is shown as any => incorrect pointing the mouse over B (right from equal sign) in constructor : B is shown as number => correct pointing the mouse over @myC in constructor : @myC is shown as any => seems to be correct, since C is an object pointing the mouse over C (right from equal sign) in constructor : C is shown as number => seems to be correct, since C is an object pointing the mouse over @test in constructor : @test is shown as any => incorrect pointing the mouse over test in constructor : test is shown as string => correct pointing the mouse over this.test2 in constructor : this.test2 is shown as any => incorrect
pointing the mouse over var m in method1 : m is shown as number => correct pointing the mouse over var x in method1 : x is shown as number => correct pointing the mouse over var y in method1 : y is shown as number => correct
pointing the mouse over var x in method2 : x is shown as number => correct pointing the mouse over var y in method2 : y is shown as number => correct pointing the mouse over methodname method2 : return is shown as number => correct