-
-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v12 broke Typescript types #2869
Comments
@spike-rabbit this is a set of changes to step towards embracing correct ESM publishing and ingestion. It is a major version bump because of these breaking changes. You can see more context on how we've landed here in this issue: #2785 We are open to suggestions and more specifically a PR if you think there's a more straightforward way to support all scenarios, we've just not discovered it. If you're using |
@spike-rabbit this is only a problem if you want to explicitly set types like that, right? Like if you just call |
I fully support moving to ESM, even if this requires a breaking change.
The other thing is, that the types does not match reality. import {Tour} from 'shepherd.js/tour'
const tour = new Tour(); But currently, this does work as this import would be resolved by a Bundler to: I see a few potential fixes here:
I am not familiar with rollup, so I cannot tell which approach would be best. As long as the type matches the actual code I am happy. Yes, this still works: |
@spike-rabbit I think what we want here is to ship just one |
@spike-rabbit would you be able to pull down #2871 and build it and try it out? I am making it just build one declaration file now, but I am unsure if this is what you wanted or not or if it might break other things. |
fixed by #2871 |
There were two undocumented breaking changes in v12:
With v11 something like this worked:
This is broken in v12 as Shepard is no longer a namespace (it was before).
In v12, one has to write this as:
This is in my opinion a horrible DX, as Tour only acts as a type, as there is no
tour.mjs
file. So one cannot callnew Tour()
.On the other side,
Shepherd.Tour
cannot be used as a type, since (as already mentioned)Shepherd
is not a namespace.The second breaking change is, that
moduleResolution: 'node'
no longer works, as the types are part of the exports field, so one had to update the package.json to usemoduleResolution: 'Bundler'
.It would be really cool, if you could improve the types to be at least compatible with v11.
The text was updated successfully, but these errors were encountered: