mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-17 17:48:06 +00:00
🤖 Merge PR #65592 [imap-simple] expose imap field type by @tennox
* [imap-simple] expose imap field type imap-simple allows to access the underlying `node-imap` instance, but the types were not including it. * [imap-simple] add test & remove illegal whitespace * whitespace fix index.d.ts --------- Co-authored-by: Manu [tennox] <tennox+git@txlab.io>
This commit is contained in:
@@ -117,6 +117,7 @@ imaps.connect(config).then(connection => {
|
||||
|
||||
imaps.connect(config).then(function (connection) {
|
||||
connection.openBox('INBOX').then(function () {
|
||||
console.log("Connection state:", connection.imap.state);
|
||||
const searchCriteria = ['ALL'];
|
||||
const fetchOptions = { bodies: ['TEXT'], struct: true };
|
||||
return connection.search(searchCriteria, fetchOptions);
|
||||
|
||||
3
types/imap-simple/index.d.ts
vendored
3
types/imap-simple/index.d.ts
vendored
@@ -40,6 +40,9 @@ export interface Message {
|
||||
export class ImapSimple extends EventEmitter {
|
||||
constructor(imap: Imap);
|
||||
|
||||
/** Access underlying `node-imap` instance */
|
||||
imap: Imap; // https://github.com/chadxz/imap-simple/blob/master/lib/imapSimple.js#L22
|
||||
|
||||
/** Open a mailbox, calling the provided callback with signature (err, boxName), or resolves the returned promise with boxName. */
|
||||
openBox(boxName: string, callback: (err: Error, boxName: string) => void): void;
|
||||
openBox(boxName: string): Promise<string>;
|
||||
|
||||
Reference in New Issue
Block a user