Open Sacro opened 6 years ago
I created type definitions: https://github.com/DanielRose/DefinitelyTyped/tree/stompit
If no-one complains, I'll send a PR to DefinitelyTyped.
@DanielRose how about submitting a PR here too? I think a better place for TS typings is the original repo.
@gdaws It is up to the maintainer what would be preferred. The type definitions could be bundled with the package as well.
The type definitions were merged and can now be found in https://www.npmjs.com/package/@types/stompit
Hi, could be that the merged types are now obsolete?
For example, in the type connect.connectOptions
the host
property only exists inside connectHeaders
and not also in the parent object as the actual JavaScript documentation shows.
Thanks!
@hazzo The type connect.ConnectOptions
is defined as:
type ConnectOptions = NetTcpConnectOptions | NetIpcConnectOptions | SslConnectOptions;
Their types define a host property (among others):
interface NetTcpConnectOptions extends BaseConnectOptions, TcpNetConnectOpts {
ssl?: false;
}
interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
timeout?: number;
}
interface TcpSocketConnectOpts extends ConnectOpts {
port: number;
host?: string;
localAddress?: string;
localPort?: number;
hints?: number;
family?: number;
lookup?: LookupFunction;
}
And so on. However, an IPC connection does not have a host (since it always is the same system). So to see the correct options, you'll probably have to cast/declare your options objects with the correct type.
@DanielRose thanks! I missed completely the extended interfaces!!! T_T
I would love to use this library with Typescript rather than Javascript, are there any typings available?