Closed orimay closed 2 years ago
Won't this remove a lot of type information? https://github.com/amark/gun/wiki/TypeScript-Guide won't work anymore
Isn't this page related to @types/gun package?
It was, but the example there works with the version in the repository without @types/gun
. The current definition for the gun constructor is:
new <DataType extends IGunDataType= IGunDataType>(options?: IGunConstructorOptions): IGunInstance<DataType,undefined>;
which allows you to define the structure of your GUN database, whereas in this PR it's:
new (options?: GunOptions): IGunInstance;
Don't get me wrong, the current typings aren't 100% correct and I'm sure this PR solves a lot of issues (I first came across it because in the current version the types for .map()
are wrong but yours are right), but it'd be a shame to lose the functionality laid out in that wiki article.
I see. I'm a bit busy lately, but I'll take a look at if I'll be able to make it work with generic GUN instance the way it currently does
I think I nailed it. Gonna check it on my pet project first before push
I think it's ready now :)
HOLY MIND BLOW!!!!!!!!!!
What an amazing incredible labor of love.
⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐
I'm angry that @amark didn't merge this earlier. We should pester him.
(seriously, don't be shy. I know I'm delayed a lot, but sometimes its that I didn't even get a notification)
You know what this means right? I'm going to ask you to write a script/bot that will automatically pull all your comments & paste them into docs please please please please?
But my comments mostly come from your docs. Also, I believe, docs need a separate look
ts-gun wen
Old TS definitions were not covering many use cases and were lying about some types (like that get returns a promise).
Also, new type definitions cover some undocumented stuff, like those
on
hooks we were planning to discuss, e.g.create
,opt
,in
,out
,get
,put
,hi
,bye
— they are all typed now.Also, almost no deprecated methods have typings now.
Made it so that optional libs (like then, promise) types only imported on such libs import, so no type suggestions occur for non-imported libs anymore