-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Description
I wrote a small .d.ts for part of the codebase, and I'd love it if it was on definitelyTyped instead. Would you want me to open this there or anything? I figure even if its only a tiny part of the code, it might be nice to have as a starting point.
type SoapOptions = {
timeout?: number;
time?: boolean;
} & Record<string, unknown>;
type SoapReturnCallback<TYPE> = (
error: any,
envelope: string,
result?: {
return: TYPE;
},
soapHeader: any
) => void;
type SoapReturnPromise<TYPE> = Promise<{
envelope: string;
result?: {
return: TYPE;
};
soapHeader: any;
}>;
interface SoapOperation<FN extends Function> {
(
args: Parameters<FN>[0],
opts?: SoapOptions,
extraHeaders?: any
): SoapReturnPromise<ReturnType<FN>>;
(
args: Parameters<FN>[0],
callback: SoapReturnCallback<ReturnType<FN>>,
opts?: SoapOptions,
extraHeaders?: any
): void;
(
args: Parameters<FN>[0],
opts: SoapOptions | undefined,
callback: SoapReturnCallback<ReturnType<FN>>
): void;
(
args: Parameters<FN>[0],
opts: SoapOptions | undefined,
extraHeaders: any,
callback: SoapReturnCallback<ReturnType<FN>>
): void;
}
/**
* Converts a function map into a SOAP API
*/
export type SoapAPI<API extends {}> = {
[Prop in keyof API]: API[Prop] extends Function
? SoapOperation<API[Prop]>
: SoapAPI<API[Prop]>;
};
declare module 'strong-soap' {
export const soap: {
BasicAuthSecurity: new (username: string, password: string) => {};
Client: new <API>() => SoapAPI<API> & {
describe(): any;
setEndpoint(endpoint: string): void;
setSecurity(security: BasicAuthSecurity): void;
};
createClient<T>(
url: string,
options: {endpoint?: string} & Record<string, unknown>,
callback: (err: Error, client: InstanceOf<Client<T>>) => void,
endpoint?: string
): void;
createClient<T>(
url: string,
callback: (err: Error, client: InstanceOf<Client<T>>) => void,
endpoint?: string
): void;
};
}
kevinsandow, Deniks, david-szabo97, joshua9519, guregu and 2 more
Metadata
Metadata
Assignees
Labels
No labels