You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 2 files, I have each other referencing each other directly through the import statement.
The files look a little something like this:
LocalBucket.ts
/** * Bucket used for saving ratelimits * @protected */classLocalBucket{/** * ratelimiter used for ratelimiting requests */publicratelimiter: import("./Ratelimiter");/** * Key used internally to routify requests */publicrouteKey: string;/** * Create a new bucket * @param ratelimiter ratelimiter used for ratelimiting requests * @param routeKey Key used internally to routify requests. Assigned by ratelimiter */publicconstructor(ratelimiter: import("./Ratelimiter"),routeKey: string){this.ratelimiter=ratelimiter;this.routeKey=routeKey;}}export=LocalBucket;
Ratelimiter.ts
importLocalBucket= require("./LocalBucket");constrouteRegex=/\/([a-z-]+)\/(?:\d+)/g;constreactionsRegex=/\/reactions\/[^/]+/g;constreactionsUserRegex=/\/reactions\/:id\/[^/]+/g;constwebhooksRegex=/^\/webhooks\/(\d+)\/[A-Za-z0-9-_]+/;constisMessageEndpointRegex=/\/messages\/:id$/;/** * Ratelimiter used for handling the ratelimits imposed by the rest api * @protected */classRatelimiter{/** * An object of Buckets that store rate limit info */publicbuckets: {[routeKey: string]: LocalBucket;}={};/** * Queue a rest call to be executed * @param fn function to call once the ratelimit is ready * @param url Endpoint of the request * @param method Http method used by the request */publicqueue(fn: (bucket: import("./LocalBucket"))=>any,url: string,method: string){constrouteKey=this.routify(url,method);if(!this.buckets[routeKey])this.buckets[routeKey]=newLocalBucket(this,routeKey);this.buckets[routeKey].queue(fn);}}
Whenever tsup gets to building the .d.ts, it tries to generate this:
Although this causes an "Expected a property assignment" error which comes from the rollup dist file.
Here's the full stack:
Error: Expected a property assignment
6 | var __Ratelimiter = /*#__PURE__*/Object.freeze({
7 | __proto__: null,
> 8 | get default () { return Ratelimiter; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9 | });
10 |
11 | declare const Constants: {
at NamespaceFixer.findNamespaces (A:\Windows\Documents\GitHub\SnowTransfer\node_modules\tsup\dist\rollup.js:6121:21)
at NamespaceFixer.fix (A:\Windows\Documents\GitHub\SnowTransfer\node_modules\tsup\dist\rollup.js:6142:48)
at Object.renderChunk (A:\Windows\Documents\GitHub\SnowTransfer\node_modules\tsup\dist\rollup.js:7199:25)
at A:\Windows\Documents\GitHub\SnowTransfer\node_modules\rollup\dist\shared\rollup.js:23807:40
Error: error occured in dts build
at Worker.<anonymous> (A:\Windows\Documents\GitHub\SnowTransfer\node_modules\tsup\dist\index.js:2226:26)
at Worker.emit (node:events:513:28)
at MessagePort.<anonymous> (node:internal/worker:233:53)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:645:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
After making a type in LocalBucket which represented the RateLimiter partially as I needed it, the error went away. Although, I'm a little confused as generating a getter has no benefit and the plain names can be referenced anywhere in the file regardless of where they appear.
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
ndelangen
added a commit
to storybookjs/storybook
that referenced
this issue
Apr 26, 2023
In 2 files, I have each other referencing each other directly through the import statement.
The files look a little something like this:
LocalBucket.ts
Ratelimiter.ts
Whenever tsup gets to building the .d.ts, it tries to generate this:
Although this causes an "Expected a property assignment" error which comes from the rollup dist file.
Here's the full stack:
After making a type in LocalBucket which represented the RateLimiter partially as I needed it, the error went away. Although, I'm a little confused as generating a getter has no benefit and the plain names can be referenced anywhere in the file regardless of where they appear.
Upvote & Fund
The text was updated successfully, but these errors were encountered: