chatjs
chatjs copied to clipboard
Type definition files (for SignaR adapter)?
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?
Just a stranger:
You can get them from DefinitelyTyped using this tool:
https://github.com/typings/typings
Cheers.
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?
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.
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.