Values should be the same data structure #690
Replies: 1 comment 1 reply
-
That depends on your implementation. I don't think that nesting the value will solve a problem here. Since My take is to use an abstraction over 3rd party lib and have a Although, it may be a good idea to take a closer look at class DetailedCellError {
constructor(public value) {}
toString(): string {
return this.value
}
valueOf(): string {
return this.value
}
[Symbol.toPrimitive](hint): string {
return this.value
}
} Result: const detailedCellError = new DetailedCellError('#REF!')
console.log(+detailedCellError) // "#REF!"
console.log(`${detailedCellError}`) // "#REF!"
console.log(detailedCellError + '') // "#REF!" Note: We need a feature check for |
Beta Was this translation helpful? Give feedback.
-
Description
If you do
getCellValue
on an invalid cell then it results in this:Whereas if you perform
getCellValue
on a valid cell it produces a non object like this:22
Instead of switching data types it's always better to keep consistent and produce the same data type in my opinion so that users don't have to do if statement checks (and also because it's just more developer friendly), in this case I think
getCellValue
should always return an object like so:Or if it's valid:
This means that we don't have to do weird checks like
!value.type && ...
or something if we want to check that the cell has computed correctly.Beta Was this translation helpful? Give feedback.
All reactions