diff --git a/web/source/kmwcallback.ts b/web/source/kmwcallback.ts
index 4062302e1f..44bde84cda 100644
--- a/web/source/kmwcallback.ts
+++ b/web/source/kmwcallback.ts
@@ -1,12 +1,10 @@
+/// // Includes KMW-added property declaration extensions for HTML elements.
+
/***
KeymanWeb 10.0
Copyright 2017 SIL International
***/
-interface Document {
- selection: any
-}
-
// If KMW is already initialized, the KMW script has been loaded more than once. We wish to prevent resetting the
// KMW system, so we use the fact that 'initialized' is only 1 / true after all scripts are loaded for the initial
// load of KMW.
diff --git a/web/source/kmwexthtml.ts b/web/source/kmwexthtml.ts
new file mode 100644
index 0000000000..b6cbe6d501
--- /dev/null
+++ b/web/source/kmwexthtml.ts
@@ -0,0 +1,7 @@
+interface Document {
+ selection: any
+}
+
+interface Element {
+ shim: Element
+}
\ No newline at end of file
diff --git a/web/source/kmwosk.js b/web/source/kmwosk.ts
similarity index 99%
rename from web/source/kmwosk.js
rename to web/source/kmwosk.ts
index da137f6340..b0e0d2d6ac 100644
--- a/web/source/kmwosk.js
+++ b/web/source/kmwosk.ts
@@ -1,3 +1,6 @@
+/// // Includes KMW-added property declaration extensions for HTML elements.
+/// // Includes KMW string extension declarations.
+
/***
KeymanWeb 10.0
Copyright 2017 SIL International
@@ -292,18 +295,15 @@ if(!window['keyman']['initialized']) {
* @return {Object.} Array object with position and size of OSK container
* Description Get rectangle containing KMW Virtual Keyboard
*/
- osk['getRect'] = osk.getRect = function() // I2405
- {
- var p={};
- if(osk._DivVKbd)
- {
+ osk['getRect'] = osk.getRect = function() { // I2405
+ var p: any;
+
+ if(osk._DivVKbd) {
p['left'] = p.left = util._GetAbsoluteX(osk._DivVKbd);
p['top'] = p.top = util._GetAbsoluteY(osk._DivVKbd);
p['width'] = p.width = util._GetAbsoluteX(osk._DivVKbdHelp) - util._GetAbsoluteX(osk._DivVKbd) + osk._DivVKbdHelp.offsetWidth;
p['height'] = p.height = util._GetAbsoluteY(osk._DivVKbdHelp) - util._GetAbsoluteY(osk._DivVKbd) + osk._DivVKbdHelp.offsetHeight;
- }
- else
- {
+ } else {
p['left'] = p.left = util._GetAbsoluteX(osk._Box);
p['top'] = p.top = util._GetAbsoluteY(osk._Box);
p['width'] = p.width = util._GetAbsoluteX(osk._Box) + osk._Box.offsetWidth;
@@ -384,11 +384,12 @@ if(!window['keyman']['initialized']) {
*
* @return {Object.} Array object with OSK window position
**/
- osk.getPos = function()
- {
- var Lkbd=osk._Box, p={};
- p.left = osk._Visible ? Lkbd.offsetLeft : osk.x;
- p.top = osk._Visible ? Lkbd.offsetTop : osk.y;
+ osk.getPos = function() {
+ var Lkbd=osk._Box, p={
+ left: osk._Visible ? Lkbd.offsetLeft : osk.x,
+ top:osk._Visible ? Lkbd.offsetTop : osk.y
+ };
+
return p;
}
diff --git a/web/source/tsconfig.json b/web/source/tsconfig.json
index 3b17adfd01..24f1694a7f 100644
--- a/web/source/tsconfig.json
+++ b/web/source/tsconfig.json
@@ -9,7 +9,7 @@
"files": [
"kmwbase.js",
"keymanweb.js",
- "kmwosk.js",
+ "kmwosk.ts",
"kmwnative.ts",
"kmwcallback.ts",
"kmwkeymaps.ts",