1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 09:04:13 +02:00

fix some typings

This commit is contained in:
Robin Appelman 2017-02-12 16:32:38 +01:00
commit ba7ce734e3
7 changed files with 146 additions and 95 deletions

View file

@ -1,11 +1,12 @@
import {Parser} from './Parser';
import {Packet} from "../../Data/Packet";
export function make(name: string, definition: string): Parser {
const parts = definition.substr(0, definition.length - 1).split('}');//remove leading } to prevent empty part
const items = parts.map(function (part) {
return part.split('{');
});
return function (stream) {
return function (stream):Packet {
let result = {
'packetType': name
};
@ -19,7 +20,7 @@ export function make(name: string, definition: string): Parser {
} catch (e) {
throw new Error('Failed reading pattern ' + definition + '. ' + e);
}
return result;
return <Packet>result;
}
}

View file

@ -80,7 +80,7 @@ export function UserMessage(stream: BitStream): UserMessagePacket { // 23: user
result = {
packetType: 'unknownUserMessage',
type: type
}
};
}
stream.index = pos + length;
return result;