Skip to content

Commit

Permalink
Resolve type errors in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gwbaik9717 committed Sep 9, 2024
1 parent 7ad07da commit b8b571e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ packages/sdk/src/api/yorkie/v1/resources_grpc_web_pb.d.ts
packages/sdk/src/api/yorkie/v1/resources_pb.d.ts
packages/sdk/test/vitest.d.ts
packages/sdk/lib

# react-tldraw
examples/react-tldraw/src/tldraw.d.ts
6 changes: 6 additions & 0 deletions examples/react-tldraw/src/tldraw.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Indexable, Json } from '@yorkie-js-sdk/src/document/document';
import { TDUser } from '@tldraw/tldraw';

declare module '@tldraw/tldraw' {
interface TDUser extends Indexable {}
}
2 changes: 1 addition & 1 deletion examples/vanilla-quill/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function toDeltaOperation<T extends TextValueType>(
): DeltaOperation {
const { embed, ...restAttributes } = textValue.attributes ?? {};
if (embed) {
return { insert: JSON.parse(embed), attributes: restAttributes };
return { insert: embed, attributes: restAttributes };
}

return {
Expand Down
2 changes: 1 addition & 1 deletion examples/vanilla-quill/src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export type YorkieDoc = {
export type YorkiePresence = {
username: string;
color: string;
selection: TextPosStructRange | undefined;
selection?: TextPosStructRange;
};
4 changes: 2 additions & 2 deletions packages/sdk/src/document/json/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function buildDescendants(
parent.append(textNode);
} else {
const { children = [] } = treeNode as ElementNode;
let { attributes } = treeNode as ElementNode;
const { attributes } = treeNode as ElementNode;
let attrs;

if (typeof attributes === 'object' && !isEmpty(attributes)) {
Expand Down Expand Up @@ -121,7 +121,7 @@ function createCRDTTreeNode(context: ChangeContext, content: TreeNode) {
root = CRDTTreeNode.create(CRDTTreeNodeID.of(ticket, 0), type, value);
} else if (content) {
const { children = [] } = content as ElementNode;
let { attributes } = content as ElementNode;
const { attributes } = content as ElementNode;
let attrs;

if (typeof attributes === 'object' && !isEmpty(attributes)) {
Expand Down

0 comments on commit b8b571e

Please sign in to comment.