Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Create index.d.ts #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Create index.d.ts #49

wants to merge 1 commit into from

Conversation

euginio
Copy link

@euginio euginio commented Apr 16, 2018

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

@euginio
Copy link
Author

euginio commented Apr 17, 2018

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

@nwronski
Copy link
Contributor

nwronski commented Apr 19, 2018

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).

@euginio
Copy link
Author

euginio commented Apr 20, 2018

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
Copy link
Author

euginio commented Jun 19, 2018

I think I should go to DefinitelyTyped?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants