Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion types/airbnb__node-memwatch/airbnb__node-memwatch-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as memwatch from "@airbnb/node-memwatch";
memwatch.on("foobar");
// @ts-expect-error
memwatch.on("stats", "baz");
// $ExpectType EventEmitter<DefaultEventMap>
// $ExpectType EventEmitter<any>
memwatch.on("stats", (
result, // $ExpectType GcStats
) => {
Expand Down
10 changes: 0 additions & 10 deletions types/fs-extra/test/fs-extra-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,20 +1035,10 @@ fs.rm(path, { retryDelay: 200 }, err => {
});

fs.rmdir(dir); // $ExpectType Promise<void>
fs.rmdir(dir, { maxRetries: 1 }); // $ExpectType Promise<void>
fs.rmdir(dir, { retryDelay: 200 }); // $ExpectType Promise<void>
// $ExpectType void
fs.rmdir(dir, err => {
err; // $ExpectType ErrnoException | null
});
// $ExpectType void
fs.rmdir(dir, { maxRetries: 1 }, err => {
err; // $ExpectType ErrnoException | null
});
// $ExpectType void
fs.rmdir(dir, { retryDelay: 200 }, err => {
err; // $ExpectType ErrnoException | null
});

fs.stat(path); // $ExpectType Promise<Stats>
fs.stat(path, { bigint: false }); // $ExpectType Promise<Stats>
Expand Down
34 changes: 17 additions & 17 deletions types/google-apps-script/test/google-apps-script-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,16 +1241,16 @@ const driveActivity = () => {
if (originalObject && originalObject.driveItem) {
console.log(originalObject.driveItem.file); // DriveFileReference.file is deprecated
console.log(originalObject.driveItem.driveFile);
console.log(originalObject.driveItem.folder); // DriveFileReference.folder is deprecated
console.log(originalObject.driveItem.driveFolder);
console.log(originalObject.driveItem.folder ?? "none"); // DriveFileReference.folder is deprecated
console.log(originalObject.driveItem.driveFolder ?? "none");
}
for (const target of activity.targets ?? []) {
const driveItem = target.driveItem;
if (!driveItem) continue;
console.log(driveItem.file); // DriveFile.file is deprecated
console.log(driveItem.driveFile);
console.log(driveItem.folder); // DriveFile.folder is deprecated
console.log(driveItem.driveFolder);
console.log(driveItem.folder ?? "none"); // DriveFile.folder is deprecated
console.log(driveItem.driveFolder ?? "none");
}
}
};
Expand All @@ -1268,7 +1268,7 @@ const people = () => {
},
}],
});
console.log(batchCreateContactsResponse.createdPeople?.[0].person?.names);
console.log(batchCreateContactsResponse.createdPeople?.[0].person?.names ?? "none");
const batchUpdateContactsResponse = People.People.batchUpdateContacts({
updateMask: "names,emailAddresses",
readMask: "names,emailAddresses",
Expand All @@ -1279,7 +1279,7 @@ const people = () => {
},
},
});
console.log(batchUpdateContactsResponse.updateResult?.names);
console.log(batchUpdateContactsResponse.updateResult?.names ?? "none");
People.People.batchDeleteContacts({ resourceNames: ["people/test1234"] });

const image = DriveApp.getFileById("some-photo-data-file-id").getBlob();
Expand All @@ -1290,40 +1290,40 @@ const people = () => {
photoBytes: baseImage,
sources: ["READ_SOURCE_TYPE_PROFILE", "READ_SOURCE_TYPE_CONTACT"],
}, "people/test0123");
console.log(updateContactPhotoResponse.person?.names);
console.log(updateContactPhotoResponse.person?.names ?? "none");
const deleteContactPhotoResponse = People.People.deleteContactPhoto("people/test0123", {
sources: ["READ_SOURCE_TYPE_PROFILE", "READ_SOURCE_TYPE_CONTACT"],
});
console.log(deleteContactPhotoResponse.person?.names);
console.log(deleteContactPhotoResponse.person?.names ?? "none");

// directory methods
const searchDirectoryPeopleResponse = People.People.searchDirectoryPeople({
query: "test@example.com",
readMask: "names,emailAddresses",
sources: ["DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE"],
});
console.log(searchDirectoryPeopleResponse.people?.[0].names);
console.log(searchDirectoryPeopleResponse.people?.[0].names ?? "none");
const listDirectoryPeopleResponse = People.People.listDirectoryPeople({
readMask: "names,emailAddresses",
sources: ["DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE"],
});
console.log(listDirectoryPeopleResponse.people?.[0].names);
console.log(listDirectoryPeopleResponse.people?.[0].names ?? "none");

// other contacts methods
const otherContactsListResponse = People.OtherContacts.list({
readMask: "names,emailAddresses",
sources: ["READ_SOURCE_TYPE_CONTACT", "READ_SOURCE_TYPE_PROFILE"],
});
console.log(otherContactsListResponse.otherContacts?.[0].names);
console.log(otherContactsListResponse.otherContacts?.[0].names ?? "none");
const otherContactsSearchResponse = People.OtherContacts.search({
query: "Foo",
readMask: "names,emailAddresses",
});
console.log(otherContactsSearchResponse.people?.[0].names);
console.log(otherContactsSearchResponse.people?.[0].names ?? "none");
const otherContactsCopyResponse = People.OtherContacts.copyOtherContactToMyContactsGroup({
copyMask: "names,emailAddresses,phoneNumbers",
}, "people/test0123");
console.log(otherContactsCopyResponse.names);
console.log(otherContactsCopyResponse.names ?? "none");
};

// DataSourceFormula test
Expand Down Expand Up @@ -1443,7 +1443,7 @@ function driveFileOperations() {

if (fileList.files && fileList.files.length > 0) {
console.log("Files found:");
fileList.files.forEach(file => console.log(file.name, file.id));
fileList.files.forEach(file => console.log(file.name ?? "none", file.id));
} else {
console.log("No files found.");
}
Expand Down Expand Up @@ -1474,7 +1474,7 @@ function createFolder() {
function getFile() {
if (!Drive) return;
const file = Drive.Files.get("FileID");
console.log(file.name);
console.log(file.name ?? "none");
}

function getRawFile() {
Expand All @@ -1499,7 +1499,7 @@ function listDrives() {
if (driveList && driveList.drives && driveList.drives.length > 0) {
console.log("Drives found:");
driveList.drives.forEach(drive => {
console.log(drive.name, drive.id);
console.log(drive.name ?? "none", drive.id);
});
} else {
console.log("No shared Drives found.");
Expand All @@ -1512,7 +1512,7 @@ function commentAndReply() {
const comment = Drive.Comments.create({ content: "Comment text" }, "FileID", { fields: "id" });
if (!comment.id) return;
const reply = Drive.Replies.create({ content: "Reply text" }, "FileID", comment.id, { fields: "id" });
console.log(reply.id);
console.log(reply.id ?? "none");
}

// Example: List tabs (Google Docs)
Expand Down
2 changes: 1 addition & 1 deletion types/hubot/hubot-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const message = new Message(user);
const robot = new Robot<Adapter>("src/adapters", false, "hubot");
robot; // $ExpectType Robot<Adapter>
robot.name; // $ExpectType string
robot.events; // $ExpectType EventEmitter<DefaultEventMap>
robot.events; // $ExpectType EventEmitter<any>
robot.brain; // $ExpectType Brain<Adapter>
robot.alias; // $ExpectType string
robot.adapterName; // $ExpectType string
Expand Down
19 changes: 4 additions & 15 deletions types/imap/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ declare namespace Connection {

/** Given in a 'message' event from ImapFetch */
export interface ImapMessage extends NodeJS.EventEmitter {
on(event: string, listener: Function): this;
on(event: "body", listener: (stream: NodeJS.ReadableStream, info: ImapMessageBodyInfo) => void): this;
on(event: "attributes", listener: (attrs: ImapMessageAttributes) => void): this;
on(event: "end", listener: () => void): this;
on(event: string | symbol, listener: (...args: any) => void): this;
}

export interface FetchOptions {
Expand All @@ -125,11 +125,12 @@ declare namespace Connection {

/** Returned from fetch() */
export interface ImapFetch extends NodeJS.EventEmitter {
on(event: string, listener: Function): this;
on(event: "message", listener: (message: ImapMessage, seqno: number) => void): this;
on(event: "error", listener: (error: Error) => void): this;
once(event: string, listener: Function): this;
on(event: string | symbol, listener: (...args: any[]) => void): this;
once(event: "message", listener: (message: ImapMessage, seqno: number) => void): this;
once(event: "error", listener: (error: Error) => void): this;
once(event: string | symbol, listener: (...args: any[]) => void): this;
}

export interface Folder {
Expand Down Expand Up @@ -267,18 +268,6 @@ declare namespace Connection {
declare class Connection extends EventEmitter implements Connection.MessageFunctions {
constructor(config: Connection.Config);

// from NodeJS.EventEmitter
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;

// from MessageFunctions
/** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */
search(criteria: any[], callback: (error: Error, uids: number[]) => void): void;
Expand Down
10 changes: 0 additions & 10 deletions types/jake/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,6 @@ declare global {
*/
reenable(): void;

addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
complete(value?: any): void;
value: any;

Expand Down
2 changes: 1 addition & 1 deletion types/libpq/libpq-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ describe("connecting with bad credentials", () => {
return;
}

assert.fail(null, null, "Should have thrown an exception", "");
assert.fail("Should have thrown an exception");
});
});

Expand Down
2 changes: 1 addition & 1 deletion types/nanomsg/nanomsg-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ sub.on("data", buf => {
sub.close(); // $ExpectType void
});

setTimeout(_ => {
setTimeout(() => {
pub.send("Hello from nanomsg!"); // $ExpectType number
}, 100);
2 changes: 1 addition & 1 deletion types/newman/newman-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const workingDir = "path/to/working/directory";
const insecureFileRead = true;
const requestAgent = new http.Agent();

// $ExpectType EventEmitter<DefaultEventMap>
// $ExpectType EventEmitter<any>
run(
{
collection,
Expand Down
2 changes: 1 addition & 1 deletion types/node-red/node-red-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function REDTests() {
// $ExpectType Util
RED.util;

// $ExpectType EventEmitter<DefaultEventMap>
// $ExpectType EventEmitter<any>
RED.events;

// $ExpectType Hooks
Expand Down
1 change: 1 addition & 0 deletions types/node/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
!**/*.d.*.ts
/v20/
/v22/
/v24/
Loading