Sugar icon indicating copy to clipboard operation
Sugar copied to clipboard

Typescript definitions missing Constructor

Open chris-codaio opened this issue 7 years ago • 8 comments

It looks like the version of sugar.d.ts I get through npmjs is missing the Constructor definition for some types.

Error at node_modules/sugar-date/sugar.d.ts:48:18: Namespace 'sugarjs.Array' has no exported member 'Constructor'.
Error at node_modules/sugar-date/sugar.d.ts:50:24: Namespace 'sugarjs.Function' has no exported member 'Constructor'.
Error at node_modules/sugar-date/sugar.d.ts:52:20: Namespace 'sugarjs.Object' has no exported member 'Constructor'.
Error at node_modules/sugar-date/sugar.d.ts:53:20: Namespace 'sugarjs.RegExp' has no exported member 'Constructor'.
Error at node_modules/sugar-date/sugar.d.ts:54:20: Namespace 'sugarjs.String' has no exported member 'Constructor'.

I compared the version I get through npmjs against the version in the repo here and they don't match...it looks like the ones here do contain the proper Constructor definitions. Do I just need to wait for a new release for these to work?

chris-codaio avatar May 12 '17 00:05 chris-codaio

Yeah... working on the Typescript declarations right now. It's taken longer than expected but it should be coming soon!

andrewplummer avatar May 12 '17 09:05 andrewplummer

At the moment, sugar-date's type library makes it impossible to get tslint to pass. I think just publishing what you have would unblock this. Is that something that could happen soon?

chris-codaio avatar May 12 '17 15:05 chris-codaio

The problem is that I have to do a major rework to build the types dynamically so it's not quite that simple... As I mentioned though it IS getting close, and I'll work to make it even sooner, but can't really make promises. That said, I'm willing to accept a PR if you can help figure out what you need in sugar.d.ts to change.

Also just a note, the next version will be publishing the declarations to @types instead of in this repo.

andrewplummer avatar May 12 '17 18:05 andrewplummer

As far as I can tell, I don't think any changes to sugar.d.ts are necessary. Just a re-publish such that the sugar.d.ts that I pull down from npmjs matches the one you have checked in here.

In other words, things work fine for me if I manually overwrite node_modules/sugar-date/sugar.d.ts with the one in the root of this repo.

chris-codaio avatar May 12 '17 19:05 chris-codaio

Any updates on the published update to @types? Looking forward to it :)

chris-codaio avatar Jun 14 '17 00:06 chris-codaio

Sorry, not yet, but it's coming soon, I promise!

andrewplummer avatar Jun 17 '17 02:06 andrewplummer

Any update on this?

HardlyMirage avatar Feb 22 '19 21:02 HardlyMirage

Hello... very sorry, my definition of "soon" appears to be very bendable, but I promise it's still coming!

andrewplummer avatar Mar 07 '19 00:03 andrewplummer