Today marks my introduction to Angular 2 using TypeScript, and I am embarking on creating a basic getter and setter service.
import {Injectable} from "angular2/core";
@Injectable()
export class TaskService {
private _tasks:Array = [];
get tasks():Array {
return this._tasks;
}
set tasks(value:Array) {
this._tasks = value;
}
}
I am encountering an error with the TypeScript compiler that I can't seem to resolve. Could someone shed some light on why these errors are occurring?
ERROR in [default] /Users/testguy/WebstormProjects/angular2-seed/src/app/services/task-service.ts:6:17
Generic type 'Array<T>' requires 1 type argument(s).
ERROR in [default] /Users/testguy/WebstormProjects/angular2-seed/src/app/services/task-service.ts:8:14
Generic type 'Array<T>' requires 1 type argument(s).
ERROR in [default] /Users/testguy/WebstormProjects/angular2-seed/src/app/services/task-service.ts:12:18
Generic type 'Array<T>' requires 1 type argument(s).