New Typescript 1.8.4 build error: “ Build: Property 'result' does not exist on type 'EventTarget'. ”

前端 未结 14 1696
情书的邮戳
情书的邮戳 2020-12-23 14:48

I am New to typescript. In my Durandal application I migrated to VS-2012 to VS-2015 means typescript 0.9 to typescript 1.8.4. After migrated I got so many build errors. I re

14条回答
  •  时光说笑
    2020-12-23 15:13

    The above solutions didn't fit my similar issue with IndexedDB so I thought I'd share what did work in my scenario. By changing the (event) functions' arguments to (event: any) I was able to ignore the type errors.

    Sample Code:

    let request = window.indexedDB.open('userChannels', 3);
    
    request.onerror = function(event: any ) {
        console.log('ERROR: Failed to create userChannels local DB' + event.target.errorCode)
      };
    
    request.onsuccess = function(event: any) {
       let db = event.target.result;
       console.log('SUCCESS: Created userChannels local DB')
    };
    

提交回复
热议问题