-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SparseMatrix: Allow cells to contain any Json #165
Conversation
* - Non-finite numbers (NaN, +/-Infinity) are coerced to `null`. | ||
* - (null always marshalls as null) | ||
*/ | ||
export type Json<T = JsonPrimitive> = T | JsonArray<T> | JsonObject<T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just FYI - May move to Tiny-Calc, as I need it there too. For now, I'm duplicating.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll want this in sequence for annotate, and probably map/directory too. FYI: @ChumpChief
Also, rather than Json, maybe go with Serializable as the prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, yes this would be helpful for the container-like DDSs. JSON seems OK as prefix in that context, since we don't specifically require our DDSs to serialize to JSON (e.g. maybe eventually Ink serializes to ISF or InkML).
import { ISharedObject, ISharedObjectFactory } from "@microsoft/fluid-shared-object-base"; | ||
import { SharedSegmentSequence, SubSequence } from "./"; | ||
import { pkgVersion } from "./packageVersion"; | ||
|
||
export type UnboxedOper = undefined | boolean | number | string; | ||
type Cell = Json<JsonPrimitive | IComponentHandle>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kurtb - The above shows how to type a value to 'any Json + IComponentHandle'.
Fixes #138 |
// tslint:disable:interface-name | ||
|
||
export type JsonPrimitive = undefined | null | boolean | number | string; | ||
export interface JsonObject<T> extends Record<string, T | JsonArray<T> | JsonObject<T>> { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be Json<T>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some suffix we could put on Json
, maybe JsonContent
or similar? To avoid accidental conflation of Json
and JSON
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jsonable
gets several pages of relevant search results.
…40363657aa48d6285a [Snyk] Security upgrade mocha from 8.4.0 to 9.1.2
Also introduces the Json type