TypeScript: Property does not exist on type '{}'

后端 未结 7 1791
忘掉有多难
忘掉有多难 2021-01-31 13:25

I am using Visual Studio 2013 fully patched. I am trying to use JQuery, JQueryUI and JSRender. I am also trying to use TypeScript. In the ts file I\'m getting an error as follo

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 13:43

    myFunction(
            contextParamers : {
                param1: any,
                param2: string
                param3: string          
            }){
              contextParamers.param1 = contextParamers.param1+ 'canChange';
              //contextParamers.param4 = "CannotChange";
              var contextParamers2 : any = contextParamers;// lost the typescript on the new object of type any
              contextParamers2.param4 =  'canChange';
              return contextParamers2;
          }
    

提交回复
热议问题