Open freefony opened 8 years ago
i think this would explain it better than i can http://stackoverflow.com/questions/34590168/what-are-typescript-typings
Ok I see. Well if you're interested in contributing and maintaining such a thing, we can give it a go! But currently I don't think we'll spend some time on this since I haven't heard anybody in the team coding with TypeScript or Angular 2. @enguerran maybe?
It is a good idea, as it will not take so long to implement a TypeScript typings file descriptor as they are easy to write. See those kind of examples: https://github.com/typings/typings/blob/master/docs/examples.md
Is it useful? I really don't know, but it could be a quick win.
Two possibilities:
I suggest the latter.
@freefony do you think you can start a project to create the kinto-typings package?
@leplatrem does it look good to you?
I think is a bit tricky, from reading around, it is encouraged definatelytyped.org provide typings for libraries instead of library authors. since this is not a strict rule a lot of authors have gone ahead to create typings for their libs. I think we take a moment to read this thread however before we decide on what to do. It's a similar discussion for pouchdb and a lot of benefits and cons where highlighted https://github.com/pouchdb/pouchdb/issues/5389
Now maybe this should go in a diff issue but i tried using browserify to load kintojs but couldn't for angular2 ionic 2 declare var require: any const db = require('pouchdb')
works for pouchdb but wouldn't find kintojs
i tried import {kintojs} from 'kinto'
and import * as kinto from 'kinto'
both failed
@leplatrem does it look good to you?
Yes, I think so! I read the pouchdb thread quickly, and would follow Dale's advice: https://github.com/pouchdb/pouchdb/issues/5389#issuecomment-228728631
i tried import {kintojs} from 'kinto' and import * as kinto from 'kinto' both failed
import Kinto from "kinto";
should work.
I had started the work, still in progress. freefony, you can participate if you want to. Any help will be very appreciated.
cool!
I am very happy to see typings being created for Kinto. I would also be interested in helping out, although I am not entirely sure about the details.
Is my understanding correct that currently the best way to install the typings is
typings install -GS github:enguerran/kinto.js.d.ts/kinto.d.ts
?
@lgleim I am a beginner with the typings ecosystem.
typings
seems to be deprecated within TypeScript 2.0 → http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html
I am relatively certain that typings
are still needed. It has just become much easier to consume typings for non-typescript projects. I will be looking into this further.
Feel free to check out https://github.com/lgleim/kinto.js.d.ts This is a concatenation of the declaration files generated by the typescript compiler from my typescript port of Kinto at https://github.com/lgleim/kinto.js Feel free to try / enhance
Much more complete, and it may have been easier to generate the declaration file from a typescript implementation of the library. Very good idea.
I will try it one day.
I am able to build TypeScript code that uses PouchDB now. @types/pouchdb seems to be working flawlessly for me now. Should this issue be closed?
We might come back on Typescript some day, so I'd rather leave it open in case someone is interested to take over :)
Linking issue from DefinitelyTyped in case there is any movement on that end. DefinitelyTyped/DefinitelyTyped#11660
I really would like to use this, unfortunately, the code on this repo seems to not work properly on Ionic projects.
There is a project called dts-gen, this makes a start point for JS code to Typings, even with that webpack couldn't resolve some dependency.
When I simply put the JS file for kinto.js on index.html
the app crash with the message
t[v].resolve is not a function
I think that the problem is because babel provide a polyfill and there are some ES6 feature that TS does not have yet.
With a pure Angular project Kinto.js work as expected.
Hi All, I have created a hand-written definition based on Kinto.js 11.1.2. The plan is to eventually upload these to DefinitelyTyped. However, before I do that, I would like to ask for some help.
The specific URL for the repository is https://github.com/zakaluka/DefinitelyTyped/tree/master/types/kinto/ .
options
more specific based on usage I saw in the raw code.One disclaimer: I do not really know Javascript or Typescript and have never programmed in either. I am also not truly aware of the best practices in either (except what little I read and from seeing definitions for other projects). So if I'm doing something crazy, please do not hesitate to let me know - preferably in the linked repository or in this thread.
Any assistance is greatly appreciated.
@zakaluka awesome!
Unfortunately, I am unable to review this, I'm completely alien to typescript...
@freefony @cfguimaraes @jkndrkn would you still be interested in looking at this?
If there's anything to be changed in kinto.js itself, I'd glad to help :)
Of course, I see a fun job for my free time :) I'm a fan of this project, haven't used it yet in production. I like emergents technologies, this moves us forward.
On weekend I'll make some tests, and, improves if possible, and as ever, made my reports.
If anyone wants collaborator privileges into the other repository, just let me know. I'm eager to receive any help I can get.
@zakaluka taking a look at this while I try to write a sample app in Kinto + Typescript
Please take a look and let me know if I am completely off-base here. I've tried to make things like options more specific based on usage I saw in the raw code.
I'm editing them as I go -- the most major thing so far is required vs. optional parameters.
Please help me understand how to write tests for this. Should I try to translate the JS tests into TS? Or is there another strategy I should use? I honestly don't know how to proceed on this.
As I understand it, DefinitelyTyped tests are not run, merely compiled. The "test pass" is whether or not the test can be compiled. As such, they're supposed to cover all of the use cases (type-wise) of the various classes/interfaces.
@Speculative Would greatly appreciate any feedback and changes that you may have.
As for the testing, based on your statement, I'll wait to write anything until the basics of the .d.ts
file are solid.
@Speculative I know it's been a while, but do you have any changes or feedback on the specification itself? If you have an updated copy, I would love to put that into the repository and submit it to DefinitelyTyped.
Just updated the typings to 12.2.0 (at least, that's what is published on NPM and I used the latest docs to make the update).
Some of the changes I've made:
The next step is to test this, most likely by mimicking some of the current kinto.js tests from this repository.
Thanks for keeping up!
What would you like us to do?
I'm not specifically willing to maintain the types along the lib, but maybe a better coordination may help..
Do you have ideas?
Hi, I posted here more as an FYI than anything, since this is where the definition effort started.
My current goal is to write a series of tests that are similar to the tests that you use today. The goal is to determine whether the bindings are functioning as expected.
If everything goes okay, I will be submitting a pull request to DefinitelyTyped. At that point, the only thing to do would be to point people in that direction if they are looking for typescript bindings.
Until I can submit that PR, I would ask that this issue remain open so that any interested parties can find it.
Once the bindings are in DT, maybe we could talk about what type of coordination would be best to keep them up to date?
How would it look like?