andrewplummer / Sugar

A Javascript library for working with native objects.
https://sugarjs.com/
MIT License
4.53k stars 306 forks source link

Typescript definitions missing Constructor #590

Open chris-codaio opened 7 years ago

chris-codaio commented 7 years ago

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?

andrewplummer commented 7 years ago

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

chris-codaio commented 7 years ago

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?

andrewplummer commented 7 years ago

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.

chris-codaio commented 7 years ago

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 commented 7 years ago

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

andrewplummer commented 7 years ago

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

HardlyMirage commented 5 years ago

Any update on this?

andrewplummer commented 5 years ago

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