fix: move tslib from devDependencies to dependencies - #67
Open
Voltorane wants to merge 1 commit into
Open
Conversation
asadali214
added a commit
to asadali214/paragraphs-streaming-apilib
that referenced
this pull request
Jul 7, 2026
tsconfig has importHelpers: true, so tsc emits require("tslib") in the
compiled output. With tslib only in devDependencies, consumers aren't
guaranteed to get it installed — it currently works only because
@apimatic/core, @apimatic/sse, @apimatic/schema, and @apimatic/core-
interfaces each declare tslib as a real dependency and happen to get it
hoisted. If a consumer's tree instead hoists an incompatible tslib@1.x
from elsewhere, the SDK crashes with e.g.
"tslib_1.__createBinding is not a function" (a tslib 2.x-only helper).
Same root cause as paypal/PayPal-TypeScript-Server-SDK#21, fixed there
by paypal/PayPal-TypeScript-Server-SDK#67.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
asadali214
added a commit
to asadali214/paragraphs-streaming-apilib
that referenced
this pull request
Jul 7, 2026
tsconfig has importHelpers: true, so tsc emits require("tslib") in the
compiled output. With tslib only in devDependencies, consumers aren't
guaranteed to get it installed — it currently works only because
@apimatic/core, @apimatic/sse, @apimatic/schema, and @apimatic/core-
interfaces each declare tslib as a real dependency and happen to get it
hoisted. If a consumer's tree instead hoists an incompatible tslib@1.x
from elsewhere, the SDK crashes with e.g.
"tslib_1.__createBinding is not a function" (a tslib 2.x-only helper).
Same root cause as paypal/PayPal-TypeScript-Server-SDK#21, fixed there
by paypal/PayPal-TypeScript-Server-SDK#67.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tsconfig.jsonhas"importHelpers": true, which tells TypeScript to emitrequire("tslib")calls instead of inlining helper functions. However,tslibis listed indevDependenciesinstead ofdependencies— so it's available at build time but not installed for consumers at runtime.This means the SDK only works when
tslib@2.xhappens to be hoisted from transitive dependencies (e.g.@apimatic/core). If another package in the consumer's dependency tree declarestslib@^1.x(e.g.@aws-crypto/util@4.0.0) and npm hoists that version to the top level instead, the SDK crashes with:TypeError: tslib_1.__createBinding is not a functionTypeError: tslib_1.__spreadArray is not a functionThese helpers were added in tslib 2.x and don't exist in 1.x.
Fix
Move
tslibfromdevDependenciestodependencies.Fixes #21