Enable TypeScript strict mode

This commit is contained in:
Steve Sanderson 2018-01-10 10:42:08 +00:00
parent 34d3eb5b72
commit 7bbf2b54aa
4 changed files with 6 additions and 9 deletions

View File

@ -86,10 +86,6 @@ export const monoPlatform: Platform = {
//FIXME this is wastefull, we could remove the temp malloc by going the UTF16 route
//FIXME this is unsafe, cuz raw objects could be GC'd.
if (!managedString) {
return null;
}
const utf8 = mono_string_get_utf8(managedString);
const res = Module.UTF8ToString(utf8);
Module._free(utf8 as any);
@ -141,7 +137,7 @@ function addScriptTagsToDocument() {
document.write(`<script defer src="${monoRuntimeScriptUrl}"></script>`);
}
function createEmscriptenModuleInstance(loadAssemblyUrls: string[], onReady: () => void, onError: (reason: any) => void) {
function createEmscriptenModuleInstance(loadAssemblyUrls: string[], onReady: () => void, onError: (reason?: any) => void) {
const module = {} as typeof Module;
module.print = line => console.log(`WASM: ${line}`);
@ -163,7 +159,7 @@ function createEmscriptenModuleInstance(loadAssemblyUrls: string[], onReady: ()
Module.FS_createPath('/', 'appBinDir', true, true);
loadAssemblyUrls.forEach(url =>
FS.createPreloadedFile('appBinDir', `${getAssemblyNameFromUrl(url)}.dll`, url, true, false, null, <any>onError));
FS.createPreloadedFile('appBinDir', `${getAssemblyNameFromUrl(url)}.dll`, url, true, false, undefined, onError));
});
module.postRun.push(() => {

View File

@ -3,7 +3,7 @@
callEntryPoint(assemblyName: string, args: System_Object[]);
findMethod(assemblyName: string, namespace: string, className: string, methodName: string): MethodHandle;
callMethod(method: MethodHandle, target: System_Object, args: System_Object[]): System_Object;
callMethod(method: MethodHandle, target: System_Object | null, args: System_Object[]): System_Object;
toJavaScriptString(dotNetString: System_String): string;
toDotNetString(javaScriptString: string): System_String;

View File

@ -173,7 +173,7 @@ function insertText(intoDomElement: Element, textNode: RenderTreeNodePointer) {
}
function clearElement(element: Element) {
let childNode: Node;
let childNode: Node | null;
while (childNode = element.firstChild) {
element.removeChild(childNode);
}

View File

@ -5,7 +5,8 @@
"removeComments": false,
"sourceMap": true,
"target": "es5",
"lib": ["es2015", "dom"]
"lib": ["es2015", "dom"],
"strict": true
},
"exclude": [
"node_modules",