Skip to content

Commit

Permalink
fix(types): define ret type
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Jun 1, 2021
1 parent d63cabd commit c370f8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = {
'browser',
'docs',
'decorate',
'pretter'
'pretter',
'types'
]
]
}
Expand Down
16 changes: 8 additions & 8 deletions packages/src/view/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectorRef, Directive, ElementRef, Input, OnDestroy, OnInit } fr
import { AngularEditor } from "../plugins/angular-editor";
import { ELEMENT_TO_COMPONENT, ELEMENT_TO_NODE, NODE_TO_ELEMENT } from "../utils/weak-maps";
import { SlateViewContext, SlateElementContext, SlateTextContext, SlateLeafContext } from "./context";
import { Element, Range } from 'slate';
import { Descendant, Element, Range, Text } from 'slate';
import { SlateChildrenContext } from "./context";
import { hasBeforeContextChange } from "./before-context-change";

Expand Down Expand Up @@ -59,11 +59,11 @@ export abstract class BaseComponent<T = SlateTextContext | SlateLeafContext | Sl
export class BaseLeafComponent extends BaseComponent<SlateLeafContext> implements OnInit {
initailzed = false;

get text() {
get text(): Text {
return this.context && this.context.text;
}

get leaf() {
get leaf(): Text {
return this.context && this.context.leaf;
}

Expand All @@ -87,19 +87,19 @@ export class BaseElementComponent<T extends Element = Element, K extends Angular

childrenContext: SlateChildrenContext;

get element() {
get element(): Element {
return this._context && this._context.element;
}

get selection() {
get selection(): Range {
return this._context && this._context.selection;
}

get decorations() {
get decorations(): Range[] {
return this._context && this._context.decorations;
}

get children() {
get children(): Descendant[] {
return this._context && this._context.element.children;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ export class BaseElementComponent<T extends Element = Element, K extends Angular
export class BaseTextComponent extends BaseComponent<SlateTextContext> implements OnInit, OnDestroy {
initailzed = false;

get text() {
get text(): Text {
return this._context.text;
}

Expand Down

0 comments on commit c370f8f

Please sign in to comment.