完整的错误信息
当作为表达式调用时,无法解析类装饰器的签名。 “ClassDecoratorContext”类型的参数不可分配给“string |”类型的参数符号 |未定义'.
我在App Module下创建了一个book Module。在该模块中,我创建了工作服务文件。当我创建一个文件时,我得到了这个错误..?
这是我的服务文件
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@Injectable({
providedIn:"root"
})
export class BookService {
constructor(private _http: HttpClient){ }
}
这是我的书.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BookRoutingModule } from './book-routing.module';
import { HomeComponent } from './home/home.component';
import { bookReducer } from './store/reducer/book.reducer';
import { StoreModule } from '@ngrx/store';
@NgModule({
declarations: [
HomeComponent
],
imports: [
CommonModule,
BookRoutingModule,
StoreModule.forFeature('bookReducer',bookReducer)
]
})
export class BookModule { }
如果您正在使用 VSCode,请尝试重新启动您的 TypeScript 服务器。
Ctrl+Shift+P >
TypeScript: Restart TS Server
它为我修好了。