mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
28 lines
411 B
TypeScript
28 lines
411 B
TypeScript
import { format, parse, PMRMessage } from "parity-pmr";
|
|
|
|
const buffer = new Buffer("test");
|
|
const message: PMRMessage = {
|
|
messageType: 'E'
|
|
};
|
|
|
|
// $ExpectType Buffer
|
|
format(message);
|
|
|
|
// Invalid type
|
|
// $ExpectError
|
|
format('');
|
|
|
|
// $ExpectError
|
|
format({});
|
|
|
|
// Invalid sub type
|
|
// $ExpectError
|
|
format({ messageType: 1 });
|
|
|
|
// $ExpectType PMRMessage
|
|
parse(buffer);
|
|
|
|
// Invalid type
|
|
// $ExpectError
|
|
parse('');
|