google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.81k stars 366 forks source link

Provide typescript externs d.ts file #47

Closed freshp86 closed 9 years ago

freshp86 commented 9 years ago

Need a mechanism to automatically generate a d.ts file from the source code. The generated file should be hosted in our dist/ folder, but probably also a good idea to put it in https://github.com/borisyankov/DefinitelyTyped repository.

Benefit of this would be that TypeScript users can use Lovefield library without forfeiting type checking.

freshp86 commented 9 years ago

Maybe worth looking at https://github.com/fivetran/typescript-closure-tools, which converts Closure style JSDoc to Typescript externs. There is also a live page we could try to see if this works well at http://fivetran.github.io/typescript-closure-tools/.

freshp86 commented 9 years ago

Typescript definitions have been added at https://github.com/google/lovefield/commit/2af8c8079b042942f5cbce77100d5b48ed85cf60. We are still lacking an automated mechanism to do this, but given that our public API odes not change that often, not sure if investigating an automated solution is worth it.

Still keeping this bug open to track what is needed to get Lovefield's definitions to https://github.com/borisyankov/DefinitelyTyped repository.

freshp86 commented 9 years ago

FYI, sent out pull request, https://github.com/borisyankov/DefinitelyTyped/pull/4558.

freshp86 commented 9 years ago

Lovefield TypeScript definitions can now be fetched using the tsd tool (https://github.com/DefinitelyTyped/tsd) as follows,

tsd install lovefield --save

I will be updating the example at https://github.com/google/lovefield/blob/master/demos/todo_typescript/gulpfile.js shortly, and then will close this issue.

freshp86 commented 9 years ago

Example updated https://github.com/google/lovefield/commit/5f3ebb98324476da7b2fc377f06838a6b5f48a1c.