Skip to content
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

TypeScript typings #13

Open
dsebastien opened this issue Apr 14, 2020 · 3 comments
Open

TypeScript typings #13

dsebastien opened this issue Apr 14, 2020 · 3 comments

Comments

@dsebastien
Copy link

Hello,

Thanks for the project!
Could the npm package include TypeScript typings for the public API? This would benefit TypeScript users

@joelcolucci
Copy link
Owner

Hi @dsebastien! Thanks for reaching out. I'm familiar with Typescript at a high level however I haven't worked with it before.

I'm happy to look into this. Can you provide a link to a doc for what you're looking for?

@dsebastien
Copy link
Author

Hello,

Great news!
Well you have two choices; either you generate the typings as part of the project (e.g., you could convert it to TypeScript and it would generate those for you, or you could write those and simply include them with the sources and point to the d.ts file within package.json.

Alternatively, you can write the typings and send a PR to the DefinitelyTyped repo on github: https://github.com/DefinitelyTyped/DefinitelyTyped.

Here's an example of what it could look like: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/angular-file-saver/index.d.ts

Thus a namespace definition, in which you'd declare the exported functions:

declare module 'node-quill-converter' {
  function convertTextToDelta(text:string): Delta;
  function convertHtmlToDelta(htmlString: string): Delta;
  function convertDeltaToHtml(delta: Delta): string;
  
}

Or something like that.. ;-)

Note that the best (but not easiest) option is to convert the project to TypeScript, given how small it is.

HTH!

@giovannipds
Copy link

Important to check how this package is done, if you have access to Quill, it's possible that you don't need this package. slab/quill#1551

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

No branches or pull requests

3 participants