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

[Typings] Not compatible with strict compilerOptions #623

Closed
DrSensor opened this issue Apr 5, 2018 · 10 comments
Closed

[Typings] Not compatible with strict compilerOptions #623

DrSensor opened this issue Apr 5, 2018 · 10 comments
Labels

Comments

@DrSensor
Copy link

DrSensor commented Apr 5, 2018

Expected behavior

No error when using typescript with configuration complerOptions.strict and tslint:recommended enable.

Actual behavior

ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
164:5 'preventDefault', which lacks return-type annotation, implicitly has an 'any' return type.
    162 |     relatedTarget: DOMElement
    163 |     currentTarget: DOMElement
  > 164 |     preventDefault ()
        |     ^
    165 |     pageX: number
    166 |     pageY: number
    167 |     clientX: number
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
276:5 'test', which lacks return-type annotation, implicitly has an 'any' return type.
    274 |     styleCursor ( yesno: boolean ) : Interactable
    275 |     createSnapGrid ( opt: { x: number, y: number, range: number, offset: Position } ) : SnapFunction
  > 276 |     test ( x : SnapFunction )
        |     ^
    277 |   }
    278 |
    279 |   interface InteractOptions {
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
291:13 Parameter 'any' implicitly has an 'any' type.
    289 |     pointerMoveTolerance ( tol?: number ) : number | InteractStatic
    290 |     // TODO
  > 291 |     isSet ( any ) : any
        |             ^
    292 |     off ( any ) : any
    293 |     debug ( any ) : any
    294 |     addDocument ( any ) : any
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
292:11 Parameter 'any' implicitly has an 'any' type.
    290 |     // TODO
    291 |     isSet ( any ) : any
  > 292 |     off ( any ) : any
        |           ^
    293 |     debug ( any ) : any
    294 |     addDocument ( any ) : any
    295 |     removeDocument ( any ) : any
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
293:13 Parameter 'any' implicitly has an 'any' type.
    291 |     isSet ( any ) : any
    292 |     off ( any ) : any
  > 293 |     debug ( any ) : any
        |             ^
    294 |     addDocument ( any ) : any
    295 |     removeDocument ( any ) : any
    296 |   }
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
294:19 Parameter 'any' implicitly has an 'any' type.
    292 |     off ( any ) : any
    293 |     debug ( any ) : any
  > 294 |     addDocument ( any ) : any
        |                   ^
    295 |     removeDocument ( any ) : any
    296 |   }
    297 | }
ERROR in /home/wildan/Projects/Sensorfied/EDI/edi-ui/node_modules/interactjs/index.d.ts
295:22 Parameter 'any' implicitly has an 'any' type.
    293 |     debug ( any ) : any
    294 |     addDocument ( any ) : any
  > 295 |     removeDocument ( any ) : any
        |                      ^
    296 |   }
    297 | }
    298 |

Suggestion

For just temporary, I suggest any PR involving typescript should be accepted by default until there is a smoke test for supporting typescript.

System configuration

interact.js version: 1.3.3
Browser name and version: Google Chrome Version 64.0.3282.186 (Official Build) (64-bit)
Operating System: Ubuntu 16.04

@DrSensor DrSensor changed the title [Typings] implicitly has an 'any' return type [Typings] Not applicable with strict compilerOptions Apr 6, 2018
@DrSensor DrSensor changed the title [Typings] Not applicable with strict compilerOptions [Typings] Not compatible with strict compilerOptions Apr 6, 2018
@bencoveney
Copy link

👍 same issue.

We recommend all declaration files be compiled with --strict to ensure they do adhere to the strictest possible settings.

microsoft/TypeScript#18974

However that also says the skiplibcheck flag can be used as a workaround.

@tundebabzy
Copy link

Same issue to. However --skiplibcheck seems like an all or nothing fix. I think its best to try to open a PR to fix the problem. I hope it is merged and released ASAP though

@burtonator
Copy link

Same issue..

@taye
Copy link
Owner

taye commented Jan 28, 2019

I'm translating the project to typescript so, with some help, this should be resolved soon.

@burtonator
Copy link

Nice. For what it's worth I did a huge migration with Polar:

https://getpolarized.io/

... and it was a massive help! I think you'll find a huge productivity win here.

@taye
Copy link
Owner

taye commented Feb 1, 2019

The migration is done. Please update to version 1.4.0-alpha.23.

npm install interactjs@next
npm install --save-dev @interactjs/types@next

@terrymun
Copy link

@taye Thanks for releasing the types for the plugin! However, it seems like doing import interact from 'interactjs'; no longer exposes the internal types for the plugin anymore.

In the root index.d.ts, import '@interactjs/types doesn't import anything, because the types/index.d.ts only contains a reference and doesn't export any types. I might be misunderstanding TypeScript type declarations here, so please correct me if I'm wrong.

In order to get all the typings for the plugin, I will have to import the types manually, i.e.:

import interact from 'interactjs';
import { InteractEvent } from '@interactjs/types/types';

So that I can do something like this:

interact(element).draggable({
  onstart: onPanStart
});

function onPanStart(InteractEvent): void {
  // Do something
}

@taye
Copy link
Owner

taye commented Mar 2, 2019

@terrymun The Interact namespace is exposed globally so you should be able to use Interact.IteractEvent

@terrymun
Copy link

@taye Thanks for the quick reply, sorry for getting back to you a bit later. Using Interact.<...> instead of interact.<...> worked for me, since it is the namespace Interact that is being exported :) Thank you!

@stale
Copy link

stale bot commented May 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 10, 2019
@stale stale bot closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants