简体   繁体   English

错误TS2304:找不到名称“可序列化”

[英]error TS2304: Cannot find name 'Serializable'

I can't understand why it's not working, it used to, and can't find the mistake. 我不明白为什么它不起作用,它曾经使用过,也找不到错误。

I a class: 我一堂课:

//my-class.service
import { Injectable } from '@angular/core';
import { Company } from './my-data.model';

@Injectable()
export class myClass implements Serializable<myData> {
}


//my-data.model:
export class myData {

  constructor(
     public data1: string,
  ){}
}

When compiling: 编译时:

error TS2304: Cannot find name 'Serializable'.

What are I am missing? 我缺少什么?

maybe some dependence? 也许有些依赖?

You need to import Serializable from somewhere. 您需要从某个地方导入Serializable。 I can't find it in the Angular documentation. 我在Angular文档中找不到它。 I assume then it is a third party library that needs to be added via npm for example. 我假设这是一个第三方库,例如需要通过npm添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM