Skip to content

Commit

Permalink
Spread the Object into Object & Array types
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Jun 21, 2023
1 parent 25ed170 commit c2020a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class Env {
this.env = entity;
}

static get(key: string, defaultValue: any = null): FN.JSON.Object {
static get(key: string, defaultValue: any = null): any {
return this.env[key] || defaultValue;
}
}
9 changes: 5 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
export declare namespace JSON {
type Value = Date|RegExp|string|number|boolean|null|JSON.Object|any;
type Object = JSON.Value[]|{ [key: string]: JSON.Value; };
type Object = { [key: string]: JSON.Value; };
type Array = JSON.Value[]|JSON.Object[];
}

export namespace Gossip {
type Response = JSON.Object|JSON.Value;
type Response = JSON.Object|JSON.Array|JSON.Value;
type ResponseHandler = (msg: Gossip.Payload) => Promise<Gossip.Response>;
type ResponseHandlers = { [topic: string]: ResponseHandler; };
type Payload = JSON.Object;
type Payload = JSON.Object|JSON.Array|JSON.Value;
}

export declare namespace WS {
type ConnectionID = string;
type Message = JSON.Object|string;
type Message = JSON.Object|JSON.Array|JSON.Value;

type Connection = {
id: ConnectionID;
Expand Down

0 comments on commit c2020a8

Please # to comment.