sqlite-parser icon indicating copy to clipboard operation
sqlite-parser copied to clipboard

Create index.d.ts

Open euginio opened this issue 6 years ago • 4 comments

Declaration file for use sqlite-parser from Typescript code https://basarat.gitbooks.io/typescript/docs/types/ambient/d.ts.html

euginio avatar Apr 16 '18 17:04 euginio

Could you please add this file to give type support to typescript apps that uses sqlite-parser?

euginio avatar Apr 17 '18 12:04 euginio

Hi, @euginio, this is a great idea! I took a look over what you created and there are a few issues. There are three ways to invoke the main parser function. One takes a string and an option options object, and the other two take either a string, an option options, and a callback or just a string and a callback. The latter forms are used to call the parser asynchronously and provide the resulting AST or error to a callback function.

There are also a number of other properties defined on the default function, such a a version string, and some additional things that are exported by the module.

We probably also want a full set of interfaces or just an any type instead of a partial set of typings for the AST.

I believe the current process for releasing 3rd party typings for a library involves releasing them under the @types scope on npm (e.g., @types/sqlite-parser).

nwronski avatar Apr 19 '18 20:04 nwronski

Hi, @nwronski, regarding to your suggestions about issues: I'll make the changes you suggest, but I think we don't need to complete all the API the library exposes in the definition file, but it could be done on-demand. Regarding 3rd party typings: https://github.com/DefinitelyTyped/DefinitelyTyped (aka @types) is the best approach to publish definition types when you can't access to oficial package repo (your repo). But always is better to give your users TS types support from the own repo (adding this d.ts file to the root dir and the line "types": "index.d.ts", to package.json) then your TS users will have types support without installing an extra @types package

euginio avatar Apr 20 '18 17:04 euginio

I think I should go to DefinitelyTyped?

euginio avatar Jun 19 '18 13:06 euginio