Reputation: 12480
I'm developing Win8 app with TypeScript.
To compile my typescript code, I added winrt.d.ts
and winjs.d.ts
then referenced them
using:
<reference path="winrt.d.ts" static="true" />
<reference path="winjs.d.ts" static="true" />
Compile & build succeeded but IDE's intelliSense was being very slow. I simply opened winrt.d.ts
and checked the file. The file has 18,770 lines which is really huge file to compile on the fly.
Are there any options or methods to reference those huge definition file without compile again just like lib.d.ts
?
This slowness seriously hurts my TypeScript selection.
UPDATED:
On the current compiler version (0.8.0), there is no solution. Hope to see best performance gain in near future release.
UPDATED:
Here is my simply hack to boost dev. performance.
I simply created winrt.compact.d.ts
.
Then copy only part of namespaces which are actually used
and save the file.
Fortunately the file(winrt.d.ts
) looks like being generated
from several declaration files. So each namespace is
clearly separated from others.
It is much easier to make compact version for WinRT.
Upvotes: 10
Views: 3806
Reputation: 250942
There is currently a work item outstanding for this issue on Codeplex:
http://typescript.codeplex.com/workitem/265
There is nothing you can currently do to improve this (except give the compiler more hardware!) But hopefully the work item will be picked up and the issue will be resolved.
Upvotes: 2
Reputation: 8084
Correct me if I'm wrong, but I don't think that lib.d.ts
is being treated in any special way by the compiler. I took a look at the source code and here is the snippet that deals with lib.d.ts
:
if(this.compilationSettings.useDefaultLib) {
var compilerFilePath = this.ioHost.getExecutingFilePath();
var binDirPath = this.ioHost.dirName(compilerFilePath);
var libStrPath = this.ioHost.resolvePath(binDirPath + "\\lib.d.ts");
code = new TypeScript.SourceUnit(libStrPath, null);
this.compilationEnvironment.code.push(code);
}
If the user requests lib.d.ts
to be included, it is simply added to the compilation environment as the first piece of code to compile. All other source files (stored in opts.unnamed
are added in exactly the same way:
for(var i = 0; i < opts.unnamed.length; i++) {
code = new TypeScript.SourceUnit(opts.unnamed[i], null);
this.compilationEnvironment.code.push(code);
}
So if lib.d.ts
is not being treated in a special way then this is also not possible for other (declaration) files. Also, on my system lib.d.ts
has 7,677 lines, which is way less than the reported 18,770 for winrt.d.ts
, so it may be that the sum of all the lines is just too much for the compiler to achieve acceptable speed.
Other than that, my only idea is that "something else" is causing the slowdown of your machine. If you provide me with a link to the libraries and a snippet of your code, I can at least measure how long a compilation run takes on my system.
Upvotes: 2