plausible / plausible-tracker

Frontend library to interact with Plausible Analytics
https://github.com/plausible/plausible-tracker
MIT License
215 stars 50 forks source link

Syntax error with TypeScript < 3.8 on re-exporting types #36

Open caspervg opened 2 years ago

caspervg commented 2 years ago

Versions

Describe the bug

As previously explained in the (failed) PR #33, the package currently uses the syntax export type { TypeName } from './lib/module'; to re-export PlausibleOptions and EventOptions. That syntax has only been supported since TypeScript 3.8 (see the changelog here). Admittedly, that is a version from February 2020, so it has been supported already for awhile. In older versions, the following syntax error occurs on build when attempting to use the library:

image

Expected behavior

Unfortunately we are stuck in TypeScript 3.4 with no easy upgrade path, and it would be nice if some older versions of TypeScript could be supported.

Steps to reproduce

Steps:

  1. Install normally in an environment with TS 3.4 (or any other TS < 3.8)
  2. Set it up
  3. Try to use it

Your Environment

Additional context

I am currently preparing a new PR that fixes this issue for TS 3.4 and up (and older versions also) and will continue to work for newer versions also, without breaking the build/tests