analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Enhance & update type support

Open DavidWells opened this issue 4 years ago • 2 comments

Types were originally implemented with JSdoc before typescript proper supported this for type generation. This led to the kind of funky setup here.

The js first + JSdocs approach has been working well in a number of my other projects and it's time to update that over c'here 😃

Todo:

  • [ ] Use tsc --noEmit false --emitDeclarationOnly true for cleaner typegen
  • [ ] Update variadic functions like identity ref

Related:

  • https://github.com/DavidWells/analytics/issues/172

Reference material:

  • https://gils-blog.tayar.org/posts/jsdoc-typings-all-the-benefits-none-of-the-drawbacks/
  • https://github.com/giltayar/jsdoc-typing

DavidWells avatar Jun 30 '21 06:06 DavidWells

The docs are currently saying that typescript is fully supported:

https://github.com/DavidWells/analytics#typescript-support

If the TypeScript support isn't coming soon, I wonder if the README should be updated.

Any reason not to just convert everything to TypeScript? Then you get the benefits of TypeScript and generating types becomes easier as well.

dobesv avatar Aug 09 '22 06:08 dobesv

agreed, that snippet in the README makes it a bit confusing that e.g. @analytics/segment does not bundle types

alex-grover avatar Oct 07 '22 19:10 alex-grover