diff --git a/web/source/kmwexthtml.ts b/web/source/kmwexthtml.ts
index 643178dd77..d83ad8912d 100644
--- a/web/source/kmwexthtml.ts
+++ b/web/source/kmwexthtml.ts
@@ -1,3 +1,8 @@
+interface Window {
+ attachEvent: (eventNameWithOn:string, callback: () => void) => void,
+ clientWidth: number
+}
+
interface Document {
selection: any // Is IE only; TS ignores it because of this.
}
diff --git a/web/source/kmwuibutton.js b/web/source/kmwuibutton.ts
similarity index 99%
rename from web/source/kmwuibutton.js
rename to web/source/kmwuibutton.ts
index 0bf8a8bcd1..43bd5f8da3 100644
--- a/web/source/kmwuibutton.js
+++ b/web/source/kmwuibutton.ts
@@ -412,13 +412,13 @@ if(!window['keyman']['ui']['name']) {
if(!ui.init) return;
// Clear existing list first (first two nodes must be preserved)
- for(var i=ui._KeymanWeb_KbdList.childNodes.length; i>2; i--)
+ for(var i:number=ui._KeymanWeb_KbdList.childNodes.length; i>2; i--)
ui._KeymanWeb_KbdList.removeChild(ui._KeymanWeb_KbdList.childNodes[i-1]);
var kbds=keymanweb['getKeyboards']();
if(kbds.length > 0)
{
- for(var i=0; i // Includes KMW-added property declaration extensions for HTML elements.
+
/***
KeymanWeb 10.0
Copyright 2017 SIL International
diff --git a/web/source/kmwuitoggle.js b/web/source/kmwuitoggle.ts
similarity index 98%
rename from web/source/kmwuitoggle.js
rename to web/source/kmwuitoggle.ts
index bab841e989..db999135cf 100644
--- a/web/source/kmwuitoggle.js
+++ b/web/source/kmwuitoggle.ts
@@ -1,3 +1,5 @@
+/// // Includes KMW-added property declaration extensions for HTML elements.
+
/***
KeymanWeb 10.0
Copyright 2017 SIL International
@@ -32,7 +34,7 @@ if(!window['keyman']['ui']['name']) {
if(util['isTouchDevice']()) throw '';
// Initialize user interface common variables
- var ui=keymanweb['ui'] = {
+ var ui:any=keymanweb['ui'] = {
name: 'toggle',
initialized: false,
controller: null,
@@ -460,7 +462,7 @@ if(!window['keyman']['ui']['name']) {
if(_kbds.length > 1)
{
// Multiple keyboards
- var _kmw_ctrl_img=document.getElementById('KMW_Controller_Img')
+ var _kmw_ctrl_img= document.getElementById('KMW_Controller_Img')
_kmw_ctrl_img.src = imgPath+'kmw_logo_16_down.gif';
_kmw_ctrl_img.style.width = '100%';
@@ -482,7 +484,7 @@ if(!window['keyman']['ui']['name']) {
// Single keyboard
else if(_kbds.length == 1)
{
- var _kmw_ctrl_img=document.getElementById('KMW_Controller_Img')
+ var _kmw_ctrl_img= document.getElementById('KMW_Controller_Img')
_kmw_ctrl_img.src = imgPath+'kmw_logo_16.gif';
ui.kbdButton.getElem().id = 'kmwico';
diff --git a/web/source/kmwuitoolbar.js b/web/source/kmwuitoolbar.ts
similarity index 99%
rename from web/source/kmwuitoolbar.js
rename to web/source/kmwuitoolbar.ts
index 5965491f7a..66f7ecbf1e 100644
--- a/web/source/kmwuitoolbar.js
+++ b/web/source/kmwuitoolbar.ts
@@ -326,7 +326,7 @@ if(!window['keyman']['ui']['name']) {
languageCode = Keyboards[j]['LanguageCode'];
max++;
}
- max = ((max+3)/4).toFixed(0); // Get number of entries per column
+ max = Number(((max+3)/4).toFixed(0)); // Get number of entries per column
// Add language list to columns for the region
languageCode='';
diff --git a/web/source/tsconfig.base.json b/web/source/tsconfig.base.json
new file mode 100644
index 0000000000..7b892a7f12
--- /dev/null
+++ b/web/source/tsconfig.base.json
@@ -0,0 +1,9 @@
+{
+ "compilerOptions": {
+ "allowJs": true,
+ "module": "system",
+ "outDir": "../output/",
+ "sourceMap": true,
+ "target": "es5"
+ }
+}
diff --git a/web/source/tsconfig.json b/web/source/tsconfig.json
index 32611c32d9..0138b46b99 100644
--- a/web/source/tsconfig.json
+++ b/web/source/tsconfig.json
@@ -1,19 +1,3 @@
{
- "compilerOptions": {
- "allowJs": true,
- "module": "system",
- "outFile": "../output/keymanweb.js",
- "sourceMap": true,
- "target": "es5"
- },
- "files": [
- "kmwbase.ts",
- "keymanweb.ts",
- "kmwosk.ts",
- "kmwnative.ts",
- "kmwcallback.ts",
- "kmwkeymaps.ts",
- "kmwlayout.ts",
- "kmwinit.ts"
- ]
+ "extends": "./tsconfig.web.json"
}
diff --git a/web/source/tsconfig.ui.json b/web/source/tsconfig.ui.json
new file mode 100644
index 0000000000..8925b203a2
--- /dev/null
+++ b/web/source/tsconfig.ui.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.base.json",
+ "files": [
+ "kmwuibutton.ts",
+ "kmwuifloat.ts",
+ "kmwuitoggle.ts",
+ "kmwuitoolbar.ts"
+ ]
+}
diff --git a/web/source/tsconfig.web.json b/web/source/tsconfig.web.json
new file mode 100644
index 0000000000..f383773fce
--- /dev/null
+++ b/web/source/tsconfig.web.json
@@ -0,0 +1,16 @@
+{
+ "extends": "./tsconfig.base.json",
+ "compilerOptions": {
+ "outFile": "../output/keymanweb.js"
+ },
+ "files": [
+ "kmwbase.ts",
+ "keymanweb.ts",
+ "kmwosk.ts",
+ "kmwnative.ts",
+ "kmwcallback.ts",
+ "kmwkeymaps.ts",
+ "kmwlayout.ts",
+ "kmwinit.ts"
+ ]
+}