Skip to content

Commit

Permalink
fix(all): improve TS happiness for decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 11, 2015
1 parent acf3314 commit dd35c4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface DeprecatedOptions {
* Decorator: Enables marking methods as deprecated.
* @param optionsOrTarget Options for how the deprected decorator should function at runtime.
*/
export function deprecated(optionsOrTarget?: DeprecatedOptions, maybeKey?: string, maybeDescriptor?: Object) {
export function deprecated(optionsOrTarget?: DeprecatedOptions, maybeKey?: string, maybeDescriptor?: Object): any {
function decorator(target, key, descriptor) {
const methodSignature = `${target.constructor.name}#${key}`;
let options = maybeKey ? {} : optionsOrTarget || {};
Expand Down
2 changes: 1 addition & 1 deletion src/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Decorator: Enables mixing behaior into a class.
* @param behavior An object with keys for each method to mix into the target class.
*/
export function mixin(behavior: Object) {
export function mixin(behavior: Object): any {
const instanceKeys = Object.keys(behavior);

function _mixin(possible) {
Expand Down
5 changes: 3 additions & 2 deletions src/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ interface ProtocolOptions {
* @param name The name of the protocol.
* @param options The validation function or options object used in configuring the protocol.
*/
export function protocol(name: string, options?: ((target: any) => string | boolean) | ProtocolOptions) {
export function protocol(name: string, options?: ((target: any) => string | boolean) | ProtocolOptions): any {
options = ensureProtocolOptions(options);

let result = function(target) {
Expand Down Expand Up @@ -86,8 +86,9 @@ export function protocol(name: string, options?: ((target: any) => string | bool
* Creates a protocol decorator.
* @param name The name of the protocol.
* @param options The validation function or options object used in configuring the protocol.
* @return The protocol decorator;
*/
protocol.create = function(name: string, options?: ((target: any) => string | boolean) | ProtocolOptions) {
protocol.create = function(name: string, options?: ((target: any) => string | boolean) | ProtocolOptions): Function {
options = ensureProtocolOptions(options);
let hidden = 'protocol:' + name;
let result = function(target) {
Expand Down

0 comments on commit dd35c4f

Please sign in to comment.