类型“字符串”的参数不能分配给类型“从不”的参数

jga*_*ens 6 javascript typescript

我在第6行找到了版本2.0.3的打字稿错误。

 private getFormEncode(formValues: any): string {
    let str: Array<any> = [];
    for (let key of Object.keys(formValues)) {
      const name: string = encodeURIComponent(key);
      const value: string =  encodeURIComponent(formValues[key]);
      str.push(`${name}=${value}`);
    }
    return str.join('&');
 }
Run Code Online (Sandbox Code Playgroud)