commit
message
Cell.error is no longer of type 'any'
author
Ben Vogt <[email protected]>
date
2017-01-01 20:56:51
stats
2 file(s) changed,
7 insertions(+),
10 deletions(-)
files
README.md
src/Cell.ts
1diff --git a/README.md b/README.md
2index 1e6600d..db16d81 100644
3--- a/README.md
4+++ b/README.md
5@@ -7,6 +7,3 @@ Things I should do.
6 ### Write documentation for Sheet
7
8 ### Write documentation for Matrix
9-
10-### Cell.error should not be of type any
11-Errors should have specific types so we can have type safety when passing them.
12\ No newline at end of file
13diff --git a/src/Cell.ts b/src/Cell.ts
14index 68d0c88..4de3544 100644
15--- a/src/Cell.ts
16+++ b/src/Cell.ts
17@@ -6,7 +6,7 @@ class Cell {
18 private formula: string;
19 private value: string;
20 private dependencies: Array<string>;
21- private error: any;
22+ private error: string;
23 private id: string;
24 private row: number;
25 private col: number;
26@@ -109,15 +109,15 @@ class Cell {
27 * Set error for this cell. Usually in the case of a parse error when parsing the formula.
28 * @param error to set.
29 */
30- setError(error: any) {
31+ setError(error: string) {
32 this.error = error;
33 }
34
35 /**
36- * Get the error for this cell. If the formula is parsed properly, or is null, this could be null.
37- * @returns {any} error to return, could be Null.
38+ * Get the error for this cell. If the formula is not parsed properly, or is null, this could be null.
39+ * @returns {string} error to return, could be null.
40 */
41- getError() : any {
42+ getError() : string {
43 return this.error;
44 }
45
46@@ -128,9 +128,9 @@ class Cell {
47 */
48 getRenderedValue() : string {
49 if (this.error !== null) {
50- return this.value.toString();
51+ return this.value;
52 }
53- return this.error.toString();
54+ return this.error;
55 }
56
57 /**