简体   繁体   中英

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. I can't find it in the Angular documentation. I assume then it is a third party library that needs to be added via npm for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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