I want to add typings to the leader-line library, but I keep getting the error TypeError: leader_line_1.LeaderLine is not a constructor
I am sure it's just one small thing / concept I am overlooking or not understanding and I am going nuts over it.
Here is a stackblitz of my approach: https://stackblitz.com/edit/angular-leader-line-ovnz2v?file=src%2Fapp%2Fapp.component.ts
Here is the original stackblitz with the untyped LeaderLine:https://stackblitz.com/edit/angular-leader-line?file=src%2Fapp%2Fapp.component.ts
Note: stackblitz has problems running scripts from
angular.jsonsometimes, so I am including the script tag in the index.html to make the stackblitz work!I checked your code, ignoring the part where you want to import the types the difference between the two stackblitz is that you are missing the entry in
scriptsarray forleader-line, that might be the issue!angular.json
or
After that change the import like
why we do this is because you are declaring a variable and a type with the same name
LeaderLineso to differentiate between the two I am renaming the type usingas LeaderLineTypeand then setting the type to the propertyLeaderLine!Working stackblitz