Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
farwayer committed Apr 26, 2020
2 parents ea2c718 + 7eb86b3 commit c993d7c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ import {
ModelSnapshotType,
ModelActions,
Instance,
IAnyType,
} from 'mobx-state-tree'

type InstanceType_IfConstructor<T> = T extends new (...args: any) => infer R ? R : any;

export declare type ModelDecorator<T extends Function> = T & Model<T> & PropertyDecorator

export declare interface Model<T extends Function> {
create(snapshot?: ModelSnapshotType<ModelProperties>, env?: any): IStateTreeNode<IType<any, unknown, any>> & InstanceType<T>
create(snapshot?: ModelSnapshotType<ModelProperties>, env?: any): IStateTreeNode<IType<any, unknown, any>> & InstanceType_IfConstructor<T>
is(thing: any): boolean
props<A extends ModelProperties>(props: object): ModelDecorator<A>
actions<A extends ModelActions>(fn: (self: Instance<this>) => A): ModelDecorator<A>
props<A extends (self: Instance<this>) => ModelProperties>(props: object): ModelDecorator<A>
actions<A extends (self: Instance<this>) => ModelActions>(fn: A): ModelDecorator<A>
}

export declare type ModelOptions = {
Expand Down Expand Up @@ -114,4 +117,4 @@ export declare const types: {
setter: typeof setter,
}

export declare function getMstType(type: any): IType
export declare function getMstType(type: any): IAnyType

0 comments on commit c993d7c

Please sign in to comment.