js-stellar-sdk icon indicating copy to clipboard operation
js-stellar-sdk copied to clipboard

Fixes the types related to event types.

Open Shaptic opened this issue 1 year ago • 6 comments

Thanks to @CITGuru for reporting this! It closes #914 and #915.

Shaptic avatar Jan 29 '24 20:01 Shaptic

Size Change: 0 B

Total Size: 11.4 MB

ℹ️ View Unchanged
Filename Size
dist/stellar-sdk.js 6.31 MB
dist/stellar-sdk.min.js 5.08 MB

compressed-size-action

github-actions[bot] avatar Jan 29 '24 20:01 github-actions[bot]

@Shaptic great that helps. However, the EventSource static variable type declaration is not backward compatible. If you install this in Typescript less than 5, it throws the same error. Typescript changed from using number in older versions to using actual numbers in newer versions.

CITGuru avatar Jan 30 '24 05:01 CITGuru

Ah, so this is a breaking change, then... :facepalm: did TypeScript break this across a minor version boundary, then??

Shaptic avatar Jan 30 '24 17:01 Shaptic

But then doing something like number | 1 means downstream needs to handle the union :thinking: maybe I'll just include this in the next major version release? though that may not be for some time... this is obnoxious to say the least. What are your thoughts as a downstream user, @CITGuru? Is requiring TypeScript 5 unreasonable?

Shaptic avatar Jan 30 '24 17:01 Shaptic

But then doing something like number | 1 means downstream needs to handle the union 🤔 maybe I'll just include this in the next major version release? though that may not be for some time... this is obnoxious to say the least. What are your thoughts as a downstream user, @CITGuru? Is requiring TypeScript 5 unreasonable?

Yes, this would affect downstream users and projects who have not yet upgraded to Typescript or just can't. I had to downgrade one of our projects back to Typescript 4 as I didn't have enough bandwidth to fix all the issues as it affected other libraries still using old Typescript.

Adding union to support number | 1 might work.

CITGuru avatar Jan 30 '24 17:01 CITGuru

Hey @CITGuru just want to call out this note from the latest release (#918):

There will come a future major release in which we drop support for TypeScript 5 and other outdated tooling that will incorporate this change with enough warning to downstream systems.

Shaptic avatar Feb 13 '24 23:02 Shaptic