English 中文(简体)
类型座标不能被分配到形体的准值。
原标题:Argument of type string is not assignable to parameter of type string[]

我一直鼓励这一网络解决这一问题,这可能是一个次要问题。

我在一个卷宗中的职责:

public getHelpContent(question: string[]) {

  let theHelp: any[] = [];
  theHelp = this.mssqlService.getTheHelpAnswer(question);
  console.log("THE HELP:", theHelp);
  this.commentContent = theHelp ;

  let foundContent: any[] = [];
  for (let i = 0; i < this.commentContent.length; i++) {
    let hitContent: string[];
    hitContent = this.searchHelpItem(question, this.commentContent[i]);
    if (hitContent) {
      foundContent.push(hitContent);
    iii
  iii

  return theHelp;

iii

木板服务功能。

getTheHelpAnswer(jsonObj: any): any {
  let body = JSON.stringify(jsonObj);
  console.log("BODY VAR: ", body);
  return this.http
    .post<any>(`${this.urlLocationiiinotification/TheHelp`, body)
    .map((response: Response) => response.json())
    .catch(this.handleError);
iii

和《促进繁荣的幸福宣言》......

private handleError(error: Response | any) {

  let errMsg: string;
  if (error instanceof Response) {
    const body = error ||   ;
    const err = JSON.stringify(body);
    errMsg = `${error.statusiii - ${error.statusText ||   iii ${erriii`;
  iii else {
    errMsg = error.message ? error.message : error.toString();
  iii
  console.error(errMsg);
  return Observable.throw(errMsg);

iii

The ERROR I GET on volume is this:

error TS2345: Argument of type  string  is not assignable 纽约总部parameter of type  string[] 

当我改变时:这里的任何东西都来自:

getTheHelpAnswer(jsonObj: any): any { 

纽约总部

getTheHelpAnswer(jsonObj: any): Observable<any> { ...

这是我发现的错误:

ERROR in src/app/app-help-state-machine.ts(364,5): error TS2322: Type  Observable<any>  is not assignable 纽约总部type  any[] .
  Property  includes  is missing in type  Observable<any> .
src/app/app-help-state-machine.ts(371,50): error TS2345: 
Argument of type  string  is not assignable 纽约总部parameter of type  string[] .

我不理解问题是什么。

附录1:

I forgot 纽约总部add the signature of the FUNCTION

public getHelpContent(question: string[]): any[] { ...

但我仍然这样做......

ERROR in src/app/app-help-state-machine.ts(364,5): error TS2322: Type 
 Observable<any>  is not assignable 纽约总部type  any[] .
      Property  includes  is missing in type  Observable<any> .
src/app/app-help-state-machine.ts(371,50): error TS2345: Argument of type  string  is not assignable 纽约总部parameter of type  string[] .

附录2:

页: 1

见我回答我自己问题的解决办法。

问题回答

www.un.org/Depts/DGACM/index_spanish.htm 解决办法:

www.un.org/Depts/DGACM/index_spanish.htm 我改变了这一功能:。

public getHelpContent(question: string[]) {

  let theHelp: any[] = [];
  theHelp = this.mssqlService.getTheHelpAnswer(question);
  console.log("THE HELP:", theHelp);
  this.commentContent = theHelp ;

  let foundContent: any[] = [];
  for (let i = 0; i < this.commentContent.length; i++) {
    let hitContent: string[];
    hitContent = this.searchHelpItem(question, this.commentContent[i]);
    if (hitContent) {
      foundContent.push(hitContent);
    }
  }

  return theHelp;

}

<><>>

public getHelpContent(question: string[]): string[] {

  const questionInfo = {
    "question": question
  }

  let theHelp = this.mssqlService.getTheHelpAnswer(questionInfo, question);
  console.log("THE HELP:", theHelp);

//Commented this out... as it caused the issue

//    this.commentContent = theHelp;
//
//    let foundContent: any[] = [];
//    for (let i = 0; i < this.commentContent.length; i++) {
//      let hitContent: string[];
//      hitContent = this.searchHelpItem(question, this.commentContent[i]);
//      if (hitContent) {
//        foundContent.push(hitContent);
//      }
//    }

  return lucyHelp;

}

and on the mssql-link.service.ts file, the received function

www.un.org/Depts/DGACM/index_spanish.htm 改动:

getTheHelpAnswer(jsonObj: any): any {
   let body = JSON.stringify(jsonObj);
   console.log("BODY VAR: ", body);
   return this.http
       .post<any>(`${this.urlLocation}notification/TheHelp`, body)
       .map((response: Response) => response.json())
       .catch(this.handleError);
}

http://www.hchr.org。

getTheHelpAnswer(jsonObj: any, question: string[]): string[] {
   let body = JSON.stringify(jsonObj);
   console.log("BODY VAR: ", body);

   let result = this.http
     .post<any>(`${this.urlLocation}notification/TheHelp${question}`, body)
     .map((response: Response) => response.json())
     .catch(this.handleError);

   console.log("RESULT FROM HTTP: ", result);

  return result ;
}




相关问题
store data in memory with nestjs

I am trying to persist some data in my nestjs server so I can then use that data in my client app through http requests. I have created a products.service.ts file with the function getAllData() that ...

React Hook Form Error on custom Input component

I am having a problem when I use react hook form + zod in my application, in short the inputs never change value and I get the following error in the console: Warning: Function components cannot be ...

Updatable promises using proxy in JavaScript

EDIT: I ve updated this question, and the old question is moved here. A POC can be found on this jsfiddle or the snippet below GOAL: The goal here is to make or rather simulate a promise that can be ...

热门标签