“ TypeError:pMap.get不是函数”

时间:2019-11-20 13:07:20

标签: angular typescript

使用泛型编译datatable时遇到错误  "TypeError: pMap.get is not a function"

代码:

import { has,HashMap, map } from '@typed/hashmap';
import { element, promise } from 'protractor';

var pMap = new Map();
export class ParamManager {


    //async dt(dataTable ):Promise<ElementFinder> {
     dt(datatable )  {
        //let result = new Map();
        //var pMap = new Map();
          var result=datatable.rowsHash();

        //for (Map<String, String> data : arg1.asMaps(String.class, String.class)) {
        // result.map((item) => {

        //      pMap=item

        let tempArray=[];
        tempArray.push(result);
         tempArray.forEach(element=>{
            //element.get().toString().trim();
            pMap=element;
         } );
        // result.array.forEach(element => {
        //  element.get(0).toString().trim();
        console.log(pMap)
    }




      public getParam( key:any) :Promise<any>{
         return pMap.get(key);
    }

}

1 个答案:

答案 0 :(得分:0)

import { has,HashMap, Map } from '@typed/hashmap';

在您的imp0rt语句中确保有关地图。应该是地图