You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an instance of Plausible, Typescript infer the typing, but there is not an explicit interface to import to use in our TS apps.
Context
When using this library in a class, like in Angular Services, you might want to declare the class property, give it a type and in the constructor or in the init() method of your class, you might want to create the instance. Because there is no interface, you might be forced to declare the property as any, which will make your instance untyped.
Possible Implementation
Extracting the type into an interface or type will allow devs to have an explicit type for the instance to get benefit of the strict typed system.
Detailed Description
When creating an instance of Plausible, Typescript infer the typing, but there is not an explicit interface to import to use in our TS apps.
Context
When using this library in a class, like in Angular Services, you might want to declare the class property, give it a type and in the constructor or in the init() method of your class, you might want to create the instance. Because there is no interface, you might be forced to declare the property as any, which will make your instance untyped.
Possible Implementation
Extracting the type into an interface or type will allow devs to have an explicit type for the instance to get benefit of the strict typed system.
https://github.com/plausible/plausible-tracker/blob/master/src/lib/tracker.ts#L212-L217
It should be really easy to do and will be a great benefit, imo.
I can help with a PR if this FR makes sense.
The text was updated successfully, but these errors were encountered: