-
-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No TypeScript definitions for Observable / Syncable #213
Comments
I would like to do that if there were time. Now i've spent too much time on Dexie the last weeks and need to focus on my main project (which is using observable/syncable though). I think Dexie.d.ts would have to be adjusted some way (maybe changed Dexie from class to interface with acompanied new() function, like Table and the other classes are defined to be extendable) in order for the addons to put new methods etc on its generated instances. It would be something like: declare var Dexie : new()=>IDexie; But I havent tested that it's still possible to derive a subclass when doing so. When that's done, d.ts files could be added for the addons. For Dexie.Observable this would be almost nothing. For Syncable, a few methods (https://github.com/dfahlander/Dexie.js/wiki/Dexie.Syncable.js) |
For now, just cast to any: (Dexie as any).Syncable.registerSyncProtocol (name, instance); |
If you for some reason felt very much like fixing this, your pull requests are much welcome :) |
@dfahlander Hehe... sure, I'm already using a cast to |
@dfahlander One thing that I'll definitely submit back to you is a SignalR transport. I've figured out a design based on the EventAggregatorProxy and a server-side (c#) implementation of Caliburn.Micro.EventAggregator that can dispatch to a data store adapter. Once it's baked enough to share, I'll send you a PR. |
I've also noticed that the tsc compiler doesn't pick up the typings in the package unless I'm using node module resolution and if I'm using NPM only. I am tracking some other github issues and bugs that are currently blocking this from working in jspm -- it appears you're doing everything right; it's just the module resolution in tsc that doesn't work with jspm yet... just an FYI :) |
Oh, and yes -- we'd have to modify your existing |
Interesting stuff. Thanks for sharing 👍 |
Typescript 1.8 now allows merging into an existing module scope and in the the example, they specifically demonstrate an existing class This feature is described here under the heading "Augmenting global/module scope from modules" (why no anchor tags, MS??) |
Very interesting info. Thanks! |
They've removed the typescript release notes. New location: |
Implemented Dexie.d.ts so that addons can extend events and API with Typescript 2.1 (See #213). Made a d.ts file for dexie-observable that does extend the dexie typings according to its API. Next step will be to implement d.ts also for dexie-syncable.
* Made dexie typings extendable by addons. Implemented Dexie.d.ts so that addons can extend events and API with Typescript 2.1 (See #213). Made a d.ts file for dexie-observable that does extend the dexie typings according to its API. Next step will be to implement d.ts also for dexie-syncable.
Addons now have typings in Dexie 2.0.0-beta-7. Closing. |
I tried to generate .d.ts files with the compiler after feeding it the es6 source, but it didn't come up with anything remotely logical. Any plans to release some definitions?
The text was updated successfully, but these errors were encountered: