mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Create FieldDecorator type
This commit is contained in:
parent
f0432b11ce
commit
573dff8ec2
@ -15,15 +15,20 @@ export function CosmosMessage(registry: Registry, typeUrl: string): TypeDecorato
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Like PropertyDecorator from lib.es5.d.ts but without symbol support in propertyKey.
|
||||
*/
|
||||
export type FieldDecorator = (target: object, propertyKey: string) => void;
|
||||
|
||||
export const CosmosField = {
|
||||
Boolean: (id: number) => Field.d<boolean>(id, "bool"),
|
||||
Boolean: (id: number): FieldDecorator => Field.d<boolean>(id, "bool"),
|
||||
|
||||
String: (id: number) => Field.d<string>(id, "string"),
|
||||
Bytes: (id: number) => Field.d<Uint8Array>(id, "bytes"),
|
||||
String: (id: number): FieldDecorator => Field.d<string>(id, "string"),
|
||||
Bytes: (id: number): FieldDecorator => Field.d<Uint8Array>(id, "bytes"),
|
||||
|
||||
Int64: (id: number) => Field.d<number>(id, "int64"),
|
||||
Uint64: (id: number) => Field.d<number>(id, "uint64"),
|
||||
Int64: (id: number): FieldDecorator => Field.d<number>(id, "int64"),
|
||||
Uint64: (id: number): FieldDecorator => Field.d<number>(id, "uint64"),
|
||||
|
||||
RepeatedString: (id: number) => Field.d<string[]>(id, "string", "repeated"),
|
||||
Nested: (id: number, ctor: Constructor<Message<{}>>) => Field.d(id, ctor),
|
||||
RepeatedString: (id: number): FieldDecorator => Field.d<string[]>(id, "string", "repeated"),
|
||||
Nested: (id: number, ctor: Constructor<Message<{}>>): FieldDecorator => Field.d(id, ctor),
|
||||
};
|
||||
|
18
packages/demo-protobuf/types/decorator.d.ts
vendored
18
packages/demo-protobuf/types/decorator.d.ts
vendored
@ -1,12 +1,16 @@
|
||||
import { Constructor, Message, TypeDecorator } from "protobufjs";
|
||||
import { Registry } from "./registry";
|
||||
export declare function CosmosMessage(registry: Registry, typeUrl: string): TypeDecorator<any>;
|
||||
/**
|
||||
* Like PropertyDecorator from lib.es5.d.ts but without symbol support in propertyKey.
|
||||
*/
|
||||
export declare type FieldDecorator = (target: object, propertyKey: string) => void;
|
||||
export declare const CosmosField: {
|
||||
Boolean: (id: number) => import("protobufjs").FieldDecorator;
|
||||
String: (id: number) => import("protobufjs").FieldDecorator;
|
||||
Bytes: (id: number) => import("protobufjs").FieldDecorator;
|
||||
Int64: (id: number) => import("protobufjs").FieldDecorator;
|
||||
Uint64: (id: number) => import("protobufjs").FieldDecorator;
|
||||
RepeatedString: (id: number) => import("protobufjs").FieldDecorator;
|
||||
Nested: (id: number, ctor: Constructor<Message<{}>>) => import("protobufjs").FieldDecorator;
|
||||
Boolean: (id: number) => FieldDecorator;
|
||||
String: (id: number) => FieldDecorator;
|
||||
Bytes: (id: number) => FieldDecorator;
|
||||
Int64: (id: number) => FieldDecorator;
|
||||
Uint64: (id: number) => FieldDecorator;
|
||||
RepeatedString: (id: number) => FieldDecorator;
|
||||
Nested: (id: number, ctor: Constructor<Message<{}>>) => FieldDecorator;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user