Skip to content

fix: move tslib from devDependencies to dependencies - #67

Open
Voltorane wants to merge 1 commit into
paypal:mainfrom
Voltorane:fix/move-tslib-to-dependencies
Open

fix: move tslib from devDependencies to dependencies#67
Voltorane wants to merge 1 commit into
paypal:mainfrom
Voltorane:fix/move-tslib-to-dependencies

Conversation

@Voltorane

Copy link
Copy Markdown

Summary

tsconfig.json has "importHelpers": true, which tells TypeScript to emit require("tslib") calls instead of inlining helper functions. However, tslib is listed in devDependencies instead of dependencies — so it's available at build time but not installed for consumers at runtime.

This means the SDK only works when tslib@2.x happens to be hoisted from transitive dependencies (e.g. @apimatic/core). If another package in the consumer's dependency tree declares tslib@^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 function
  • TypeError: tslib_1.__spreadArray is not a function

These helpers were added in tslib 2.x and don't exist in 1.x.

Fix

Move tslib from devDependencies to dependencies.

Fixes #21

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tslib error on importing the paypal server sdk

1 participant