Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Type definition files (for SignaR adapter)? #28

Open
vkelman opened this issue Oct 18, 2016 · 4 comments
Open

Type definition files (for SignaR adapter)? #28

vkelman opened this issue Oct 18, 2016 · 4 comments

Comments

@vkelman
Copy link

vkelman commented Oct 18, 2016

chatjs\chatjs\js\jquery.chatjs.adapter.signalr.ts and chatjs\ChatJs\js\jquery.chatjs.adapter.signalr.js both have top lines of

/// <reference path="../../Scripts/Typings/jquery/jquery.d.ts"/>
/// <reference path="../../Scripts/Typings/signalr/signalr.d.ts"/>

But there is no folder /Scripts and no .d.ts files in a project. I'm pretty new to TypeScript. Where can I get those missing .d.ts files?

@gtarsia
Copy link

gtarsia commented Oct 19, 2016

Just a stranger:
You can get them from DefinitelyTyped using this tool:
https://github.com/typings/typings
Cheers.

@vkelman
Copy link
Author

vkelman commented Oct 19, 2016

Visual Studio 2013 Package Manager Console:

PM> Install-Package jquery.TypeScript.DefinitelyTyped -Version 2.1.1
Installing 'jquery.TypeScript.DefinitelyTyped 2.1.1'.
Successfully installed 'jquery.TypeScript.DefinitelyTyped 2.1.1'.
Adding 'jquery.TypeScript.DefinitelyTyped 2.1.1' to chatjs.
Successfully added 'jquery.TypeScript.DefinitelyTyped 2.1.1' to chatjs.

PM> Install-Package signalr.TypeScript.DefinitelyTyped
Attempting to resolve dependency 'jquery.TypeScript.DefinitelyTyped '.
Installing 'signalr.TypeScript.DefinitelyTyped 0.4.1'.
Successfully installed 'signalr.TypeScript.DefinitelyTyped 0.4.1'.
Adding 'signalr.TypeScript.DefinitelyTyped 0.4.1' to chatjs.
Successfully added 'signalr.TypeScript.DefinitelyTyped 0.4.1' to chatjs.

Now jQuery compilation errors disappeared, but there are still multiple SignalR related errors
There are bunch of errors of type:

Build: Duplicate identifier 'hub'
Build: Duplicate identifier 'hubConnection'
Build: Duplicate identifier 'signalR

There are also errors like

Build: Supplied parameters do not match signature of call target  jquery.chatjs.controller.ts 85
Build: Cannot find name 'chatJs'                                                      jquery.chatjs.controller.ts 111
Build: Cannot find name 'YatServerAdapter'                                   jquery.chatjs.messageboards.ts 56

Maybe 'signalr.TypeScript.DefinitelyTyped 0.4.1' is a wrong version (for SignalR 2.2.1)? But there is no other typings package for signalR.

But other errors make me think that Chatjs typescript code is not synced with JavaScript code. @andrerpena, @rpaschoal?

@vkelman
Copy link
Author

vkelman commented Oct 19, 2016

OK, I understood why there were "Duplicate identifier" errors: building a project for some reason generated two SignalR type definition files: signalr-1.0.d.ts (Type definitions for SignalR 1.0) and signalr.d.ts (Type definitions for SignalR 2.2.0). Excluding first file from a project solved "Duplicate identifier" issue. I hope that SignalR 2.2.1 I'm using has identical interfaces to 2.2.0.

@vkelman
Copy link
Author

vkelman commented Oct 19, 2016

In chatjs\ChatJs\js\jquery.chatjs.controller.ts and chatjs\ChatJs\js\jquery.chatjs.messageboard.ts instead of
/// <reference path="../../Scripts/Typings/autosize/autosize.d.ts"/>
there should be
/// <reference path="../../Scripts/Typings/jquery.autosize/jquery.autosize.d.ts"/>
because that's where NuGet installs autosize typings.

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

No branches or pull requests

2 participants