Open Anonym-tsk opened 1 month ago
Would this be enough?
// Describes the 'Box' class of the spec
interface Box {
offset: Number,
size: Number,
type: String,
largesize: Number | null,
extended_type: String | null,
body_offset?: Number
}
// Describes the 'FullBox' class of the spec
interface FullBox extends Box{
version: Number,
flags: Number,
}
// Describes the interface for 'create_box' function
interface CreateBoxType {
(data: Uint8Array) : Box
}
// Describes the interface for 'create_full_box' function
interface CreateFullBoxType {
(data: Uint8Array) : FullBox
}
// Describes the interface for 'create_box_tree' function
interface CreateBoxTreeType {
(data: Uint8Array) : Array<Box|FullBox>
}
// Describes the interface for 'get_next_box' function
interface GetNextBoxType {
(data: Uint8Array, parent: Box|FullBox, tree: Array<Box|FullBox>) : Array<Box|FullBox>
}
// Describes the interface for 'extract_data' function
interface ExtractDataType {
(type: String, box: Box|FullBox, parent: Box|FullBox|null) : Box|FullBox
}
// Describes the interface for each method that generates a specific box
interface BoxMethod{
(data: Uint8Array, parent: FullBox|Box|null) : Box|FullBox
}
I'm not really familliar with typescript, so if there are any mistakes or if it misses the scope of your needs, please feel free to explain it further.
Please provide d.ts files