@types/ref-struct-di
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -5,57 +5,57 @@ // Type definitions for ref-struct-di 1.1 | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.2 | ||
import ref = require('ref-napi'); | ||
/** | ||
* This is the `constructor` of the Struct type that gets returned. | ||
* | ||
* Invoke it with `new` to create a new Buffer instance backing the struct. | ||
* Pass it an existing Buffer instance to use that as the backing buffer. | ||
* Pass in an Object containing the struct fields to auto-populate the | ||
* struct with the data. | ||
* | ||
* @constructor | ||
*/ | ||
interface StructType extends ref.Type { | ||
/** Pass it an existing Buffer instance to use that as the backing buffer. */ | ||
new (arg: Buffer, data?: {}): any; | ||
new (data?: {}): any; | ||
/** Pass it an existing Buffer instance to use that as the backing buffer. */ | ||
(arg: Buffer, data?: {}): any; | ||
(data?: {}): any; | ||
declare var StructType: { | ||
new (fields?: Record<string, string | ref.Type>, opt?: { packed?: boolean }): struct.StructType; | ||
new (fields?: Array<[string, string | ref.Type]>, opt?: { packed?: boolean }): struct.StructType; | ||
(fields?: Record<string, string | ref.Type>, opt?: { packed?: boolean }): struct.StructType; | ||
(fields?: Array<[string, string | ref.Type]>, opt?: { packed?: boolean }): struct.StructType; | ||
}; | ||
fields: { [key: string]: { type: ref.Type } }; | ||
type RefModuleLike = Pick<typeof ref, "coerceType" | "get" | "set" | "alignof" | "sizeof" | "NULL">; | ||
declare function struct(ref: RefModuleLike): typeof StructType; | ||
declare namespace struct { | ||
interface Field { | ||
type: ref.Type; | ||
offset: number; | ||
} | ||
/** | ||
* Adds a new field to the struct instance with the given name and type. | ||
* Note that this function will throw an Error if any instances of the struct | ||
* type have already been created, therefore this function must be called at the | ||
* beginning, before any instances are created. | ||
* This is the `constructor` of the Struct type that gets returned. | ||
* | ||
* Invoke it with `new` to create a new Buffer instance backing the struct. | ||
* Pass it an existing Buffer instance to use that as the backing buffer. | ||
* Pass in an Object containing the struct fields to auto-populate the | ||
* struct with the data. | ||
* | ||
* @constructor | ||
*/ | ||
defineProperty(name: string, type: ref.Type): void; | ||
interface StructType extends ref.Type { | ||
/** Pass it an existing Buffer instance to use that as the backing buffer. */ | ||
new (arg: Buffer, data?: Record<string, any>): Record<string, any>; | ||
new (data?: Record<string, any>): Record<string, any>; | ||
/** | ||
* Adds a new field to the struct instance with the given name and type. | ||
* Note that this function will throw an Error if any instances of the struct | ||
* type have already been created, therefore this function must be called at the | ||
* beginning, before any instances are created. | ||
*/ | ||
defineProperty(name: string, type: string): void; | ||
/** Pass it an existing Buffer instance to use that as the backing buffer. */ | ||
(arg: Buffer, data?: Record<string, any>): Record<string, any>; | ||
(data?: Record<string, any>): Record<string, any>; | ||
/** | ||
* Custom for struct type instances. | ||
* @override | ||
*/ | ||
toString(): string; | ||
} | ||
fields: Record<string, Field>; | ||
/** The struct type meta-constructor. */ | ||
declare var StructType: { | ||
new (fields?: object, opt?: object): StructType; | ||
new (fields?: any[]): StructType; | ||
(fields?: object, opt?: object): StructType; | ||
(fields?: any[]): StructType; | ||
/** | ||
* Adds a new field to the struct instance with the given name and type. | ||
* Note that this function will throw an Error if any instances of the struct | ||
* type have already been created, therefore this function must be called at the | ||
* beginning, before any instances are created. | ||
*/ | ||
defineProperty(name: string, type: string | ref.Type): void; | ||
/** | ||
* Custom for struct type instances. | ||
* @override | ||
*/ | ||
toString(): string; | ||
} | ||
} | ||
export = StructType; | ||
export = struct; |
{ | ||
"name": "@types/ref-struct-di", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "TypeScript definitions for ref-struct-di", | ||
@@ -19,5 +19,7 @@ "license": "MIT", | ||
"main": "", | ||
"types": "index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/ref-struct-di" | ||
}, | ||
@@ -28,4 +30,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "7234d4bb2dd5e007ef9832fd12d2da66fa7256e8a66d85009365f51ac8cc6bbf", | ||
"typeScriptVersion": "2.2" | ||
"typesPublisherContentHash": "c96c6000dcae1ee27bae4368b10dc9510e65c5e9f2a3b33d82bfdc40578b85f5", | ||
"typeScriptVersion": "3.5" | ||
} |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ref-struct-di | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ref-struct-di. | ||
Additional Details | ||
* Last updated: Sat, 18 Aug 2018 01:07:25 GMT | ||
* Dependencies: ref-napi | ||
### Additional Details | ||
* Last updated: Thu, 27 May 2021 05:31:24 GMT | ||
* Dependencies: [@types/ref-napi](https://npmjs.com/package/@types/ref-napi) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Keerthi Niranjan <https://github.com/keerthi16>, Kiran Niranjan <https://github.com/KiranNiranjan>. | ||
These definitions were written by [Keerthi Niranjan](https://github.com/keerthi16), and [Kiran Niranjan](https://github.com/KiranNiranjan). |
Sorry, the diff of this file is not supported yet
5168
51