Move interface to top

This commit is contained in:
RMidhunSuresh 2021-11-10 19:13:35 +05:30
parent 7a68c971aa
commit cd7dccd804

View file

@ -38,6 +38,20 @@ type LogItemRef = {
type LogItemValues = LogItemWithLabel | LogItemNetwork | LogItemRef; type LogItemValues = LogItemWithLabel | LogItemNetwork | LogItemRef;
interface ISerializedItem {
s: number;
d: number | null;
v: LogItemValues;
l: LogLevel;
e?: {
stack?: string;
name: string;
message: string;
};
f?: boolean;
c?: Array<ISerializedItem>;
};
export type LabelOrValues = string | LogItemValues; export type LabelOrValues = string | LogItemValues;
export type FilterCreator = ((filter: LogFilter, item: LogItem) => LogFilter) | null; export type FilterCreator = ((filter: LogFilter, item: LogItem) => LogFilter) | null;
export type LogCallback = (item: LogItem) => unknown; export type LogCallback = (item: LogItem) => unknown;
@ -150,22 +164,9 @@ export class LogItem {
console.error("Error creating log filter", err); console.error("Error creating log filter", err);
} }
} }
interface Item { let children: Array<ISerializedItem> | null = null;
s: number;
d: number | null;
v: LogItemValues;
l: LogLevel;
e?: {
stack: string | undefined;
name: string;
message: string;
};
f?: boolean;
c?: Array<Item>;
};
let children: Array<Item> | null = null;
if (this._children !== null) { if (this._children !== null) {
children = this._children.reduce((array: Array<Item>, c) => { children = this._children.reduce((array: Array<ISerializedItem>, c) => {
const s = c.serialize(filter, this.start, false); const s = c.serialize(filter, this.start, false);
if (s) { if (s) {
if (array === null) { if (array === null) {
@ -180,7 +181,7 @@ export class LogItem {
return null; return null;
} }
// in (v)alues, (l)abel and (t)ype are also reserved. // in (v)alues, (l)abel and (t)ype are also reserved.
const item: Item = { const item: ISerializedItem = {
// (s)tart // (s)tart
s: parentStartTime === null ? this.start : this.start - parentStartTime, s: parentStartTime === null ? this.start : this.start - parentStartTime,
// (d)uration // (d)uration