-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(playground): document tree rendering #52
Conversation
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 100% | 579/579 |
🟢 | Branches | 99.26% | 135/136 |
🟢 | Functions | 99.32% (+0.01% 🔼) |
145/146 |
🟢 | Lines | 100% | 555/555 |
Test suite run success
338 tests passing in 18 suites.
Report generated by 🧪jest coverage report action from 8ad3a1f
✅ Mutation testing passedReport: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-52 Mutated filessrc/utils/DeepReadonly.ts |
/** | ||
* Allows accessing Block data | ||
*/ | ||
public get data(): BlockNodeData { |
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.
We should make the return type readonly (would be nice to check if it works for nested structures as well)
/** | ||
* Returns the data associated with this value node. | ||
*/ | ||
public get value(): ValueType { |
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.
Also should be readonly as it could be array/object
* | ||
* @param value - The value to check | ||
*/ | ||
function isObject(value: unknown): value is object { |
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.
Could be extracted to a separate function
*/ | ||
export type DeepReadonly<T> = | ||
T extends (infer R)[] ? DeepReadonlyArray<R> : | ||
// eslint-disable-next-line @typescript-eslint/ban-types |
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.
You can remove this if you use (...args: unknown[]) => unknown
instead of Function
return Object.entries(descriptors).filter(([name, descriptor]) => { | ||
return descriptor.get !== undefined; | ||
}) | ||
.map(([ name ]) => { | ||
return name as keyof typeof props.node; | ||
}); |
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.
Looks like some formatting could be applied here
Now we have a base Editor Document tree rendering