Draggable: Is there official TypeScript type definitions file for this project?

Created on 29 Dec 2017  路  12Comments  路  Source: Shopify/draggable

This drag Library is really cool. Is there any official TypeScript type definitions file for this project or any is working in progress ?

feature-request help wanted question

Most helpful comment

+1

All 12 comments

@Omniroot did you mention you had to do this when working on the React adapter?

Definitely something we want to add for this library! @haoliangwu feel free to open a PR if you have time, otherwise we'll provide type definitions in the future.

@tsov no problem, I already add a temporary .d.ts to my own typescript project for translating Draggable module and its Event related class. The definition still need to be perfect, when I have done that, I will send PR to you for review.


updated: #112

+1

Another option (other than just a definition file) is to change your js file extensions to ts and start adding types to the code (at your own pace). The typescript compiler will help increase code quality and identify bugs with you. Just sayin' ;) https://www.typescriptlang.org/

+1

It looks like type definitions have been added, but how do I install them? Is it @types/shopify_draggable or something else?

@rlgreen91 it should be imported automatically as long as you use typescript in your awesome project or use the IDE that supports typescript language server, eg: vscode.

Yeah... there are no .d.ts files anywhere when you run npm install, so TypeScript has no idea what to do if you pull this into a TypeScript project.

You have to ship .ts or .d.ts files for TypeScript typings to work.

image

@qJake The .d.ts files was added after beta.8 version https://www.jsdelivr.com/package/npm/@shopify/draggable?version=1.0.0-beta.9 , but strange that npm i @shopify/draggable will install beta.8 by default.

Now the latest version is beta.11, you can install it by run npm i @shopify/[email protected].

Thanks for the clarification @zjffun - I was able to install that version of the package and TypeScript worked!

If beta.11 is stable enough you should consider promoting it to the "latest" in NPM so it downloads by default! 馃檪

I鈥檓 closing this issue because the TypeScript type definitions file was supported since v1.0.0-beta9.

Thank you!

Was this page helpful?
0 / 5 - 0 ratings