typescript compiles now failing
For the code:
export module SomeNamespace {
class File {
name: string;
isOpenEnabled() {
return false;
}
}
}
I am getting the error:
"C:/Program Files (x86)/Microsoft SDKs/TypeScript/tsc.exe" --module amd --sourcemap menu-handler.ts
C:/src/jenova/Dev/Merge/AutoTagWeb/client/libs/ExtJs.d.ts(22,1): error TS1046: 'declare' modifier required for top level element.
But when I run "tsc --module amd --sourcemap dave.ts" from the command line, it works.
I am running 7.0.2. Any idea why this is failing?
thanks - dave
Please sign in to leave a comment.
Hello!
sorry, not sure what's the problem. The compiler output shows that something is wrong with ExtJs.d.ts. I suppose that this file is indirectly included from your menu-handler.ts. And you say that no errors occur when compiling another file (dave.ts) from the command line...
Please can you attach your project so that I can see what's wrong?
The entire project is gigantic. But here's the .ts file that's failing. And I attached extjs.d.ts although it is not used in this code.
export module Dave {
class File {
nme: string;
isOpenEnabled() {
return false;
}
openClicked() {
console.log('open-Clicked');
}
aboutClicked() {
/*
Ext.onReady(function () {
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
html: 'hi there'
}).show();
});
*/
}
}
}
define([], function () {
return {
handler: new File()
};
});
Attachment(s):
ExtJs.d.ts.zip
I don't get any errors when compiling your 'dave.ts' (after adding require.d.ts + the corresponding /// <reference path/> comment to get 'define' resolved)
Your extjs.d.ts itself indeed doesn't compile, but I can see the compiler errors when modifying this file only
So it seems that your file references the extjs.d.ts (directly or indirectly)
Looks like that was it. There's a better extjs.d.ts at https://github.com/borisyankov/DefinitelyTyped/blob/master/extjs/ExtJS-4.2.0.d.ts
thanks - dave