Skip to content

Commit

Permalink
Decorate: Allow modifier when strict
Browse files Browse the repository at this point in the history
Same issue #1448, new case.
  • Loading branch information
nykula committed Sep 2, 2018
1 parent 33c761d commit 9ead12d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/api/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export interface IActionFactory {
<T extends Function>(name: string, fn: T): T & IAction

// named decorator
(customName: string): (target: Object, key: string, baseDescriptor?: PropertyDescriptor) => void
(customName: string): (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor) => void

// unnamed decorator
(target: Object, propertyKey: string, descriptor?: PropertyDescriptor): void
(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void

// @action.bound decorator
bound(target: Object, propertyKey: string, descriptor?: PropertyDescriptor): void
bound(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void
}

export var action: IActionFactory = function action(arg1, arg2?, arg3?, arg4?): any {
Expand Down
2 changes: 1 addition & 1 deletion src/api/observabledecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IEnhancer } from "../types/modifiers"
import { createPropDecorator, BabelDescriptor } from "../utils/decorators2"

export type IObservableDecorator = {
(target: Object, property: string, descriptor?: PropertyDescriptor): void
(target: Object, property: string | symbol, descriptor?: PropertyDescriptor): void
enhancer: IEnhancer<any>
}

Expand Down
3 changes: 2 additions & 1 deletion test/base/decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test("decorate should work", function() {
}

decorate(Box, {
uninitialized: observable,
uninitialized: observable.ref,
undeclared: observable,
height: observable,
sizes: observable,
Expand Down Expand Up @@ -97,6 +97,7 @@ test("decorate should work", function() {

test("decorate should work with plain object", function() {
const box = {
/** @type {boolean | undefined} */
uninitialized: undefined,
height: 20,
sizes: [2],
Expand Down

0 comments on commit 9ead12d

Please sign in to comment.