SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.58k stars 3.7k forks source link

Typescript bindings #1547

Closed smnbbrv closed 4 years ago

smnbbrv commented 5 years ago

Problem:

Hi there,

trying to use current version of sortable@1.10.0-rc2 with @types/sortablejs in ngx-sortablejs.

It works pretty well by simple

import Sortable from 'sortablejs';

however the following line export = Sortable; forces to add "allowSyntheticDefaultImports": true, to the typescript compiler options, which is, well, not that ideal, because I need to ask all my users to enable this compiler option (it is not enabled by default).

Additionally, I cannot use

import { Sortable } from 'sortablejs';

and all the module exports correspondingly because the typings are out of date.

So, basically I have two questions:

JSBin/JSFiddle demonstrating the problem:


Before you create an issue, check it:

  1. Try master-branch, perhaps the problem has been solved;
  2. Use the search, maybe we already have an answer;
  3. If not found, create an example on jsbin.com (draft) and describe the problem.

Bindings:

smnbbrv commented 5 years ago

It is actually worth mentioning that typescript typings are not just an angular thing, they are internally used by many IDEs (e.g. vs code) to produce hints in JavaScript as well. So, having the typings distributed within the package has another advantage.

owen-m1 commented 5 years ago

@smnbbrv Sure, there can be type definitions added to this repo and the main package. Did you say you are willing to help with this or should I do it?

smnbbrv commented 5 years ago

I can prepare a PR containing the current typings from definitelytyped + maybe some improvements and it would be awesome if you can review it from the current data types prospective. I guess it would be the best workflow

owen-m1 commented 5 years ago

Sure, that would be great

On Fri., Jun. 21, 2019, 10:50 a.m. Simon Bobrov, notifications@github.com wrote:

I can prepare a PR containing the current typings from definitelytyped + maybe some improvements and it would be awesome if you can review it from the current data types prospective. I guess it would be the best workflow

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SortableJS/Sortable/issues/1547?email_source=notifications&email_token=AHKIHEYJ4CEBI6452XQBETDP3TTC3A5CNFSM4H2RXRV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYIVXUQ#issuecomment-504454098, or mute the thread https://github.com/notifications/unsubscribe-auth/AHKIHEZTIC2URQBIWBQDQGDP3TTC3ANCNFSM4H2RXRVQ .

driskull commented 5 years ago

Is there a PR open for this? We're looking into using the latest typings as well :)

waynevanson commented 5 years ago

@owen-m1 I'd love to help in converting Sortable to typescript, now that the plugins API has been brought to life.

Is there a public place where we could discuss this? Currently all the possible change that were mentioned are in a PR.

I may just do a conversion that converts and adds nothing else :)

owen-m1 commented 5 years ago

@waynevanson I was thinking of making a SortableJS Discord server, so maybe we can discuss it there so that our conversation is public to other contributors.

Here is the link: https://discord.gg/PYTCSQP

waynevanson commented 5 years ago

Sounds great @owen-m1, I'm in.

waynevanson commented 4 years ago

@smnbbrv @driskull I am now a maintainer for @types/sortablejs.

I've updated it to include a lot of undocumented stuff but there's a few things I know I've missed. Create a pull there and they will be looked at.

waynevanson commented 4 years ago

Additionally, I cannot use

import { Sortable } from 'sortablejs';

and all the module exports correspondingly because the typings are out of date.

I can't find any named export of Sortable in the codebase. Could someone please point me to it if it does exist? If it does exist I can add it to the type definitions.

I mentioned this elsewhere, but we won't be supporting types in the repo. We'll support them via @types/sortablejs. I am an author of the typings and we always welcome PR's to definitely typed.

waynevanson commented 4 years ago

Closing this issue. Related #1693 is the only unresolved issue from this issue.