Skip to content

Commit

Permalink
refactor(element): use new types from @corpuscule/typings (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodin committed Jul 27, 2018
1 parent 962ff6e commit ae83286
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/element/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@corpuscule/element",
"version": "0.4.1",
"version": "0.5.0",
"description": "Custom element base class for Corpuscule",
"main": "lib/index.js",
"module": "lib/index.js",
Expand All @@ -16,7 +16,7 @@
"url": "git+https://github.com/corpusculejs/corpuscule.git"
},
"dependencies": {
"@corpuscule/typings": "^0.2.0"
"@corpuscule/typings": "^0.3.0"
},
"peerDependencies": {
"lit-html": "^0.10.0"
Expand Down
19 changes: 5 additions & 14 deletions packages/element/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CustomElement} from "@corpuscule/typings";
import {CustomElement, FieldDecorator} from "@corpuscule/typings";
import {TemplateResult} from "lit-html";

export interface PropertyOptions {
Expand All @@ -8,19 +8,10 @@ export interface PropertyOptions {
export type AttributeGuard = BooleanConstructor | NumberConstructor | StringConstructor;
export type PropertyGuard = (value: any) => boolean;

export const attribute:
(attributeName: string, guard: AttributeGuard, options?: PropertyOptions) =>
(target: unknown, propertyName: string) => void;

export const computed:
(...watchings: string[]) => // tslint:disable-line:readonly-array
(target: unknown, propertyName: string) => void;

export const property:
(guard?: PropertyGuard, options?: PropertyOptions) =>
(target: unknown, propertyName: string) => void;

export const state: (target: unknown, propertyName: string) => void;
export const attribute: (attributeName: string, guard: AttributeGuard, options?: PropertyOptions) => FieldDecorator;
export const computed: <T extends string[]>(...watchings: T) => FieldDecorator; // tslint:disable-line:readonly-array
export const property: (guard?: PropertyGuard, options?: PropertyOptions) => FieldDecorator;
export const state: FieldDecorator;

export const createRoot: unique symbol;
export const didMount: unique symbol;
Expand Down

0 comments on commit ae83286

Please sign in to comment.