Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strict mode assert typedefs #7660

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2216,6 +2216,26 @@ declare module "zlib" {

declare module "assert" {
declare class AssertionError extends Error {}
declare type AssertStrict = {
(value: any, message?: string): void;
ok(value: any, message?: string): void;
fail(message?: string | Error): void;
// deprecated since v10.15
fail(actual: any, expected: any, message: string, operator: string): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update assert.fail the same way it's done there #7915?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably

equal(actual: any, expected: any, message?: string): void;
notEqual(actual: any, expected: any, message?: string): void;
deepEqual(actual: any, expected: any, message?: string): void;
notDeepEqual(actual: any, expected: any, message?: string): void;
throws(
block: Function,
error?: Function | RegExp | (err: any) => boolean,
message?: string
): void;
doesNotThrow(block: Function, message?: string): void;
ifError(value: any): void;
AssertionError: typeof AssertionError;
strict: AssertStrict;
}
declare module.exports: {
(value: any, message?: string): void;
ok(value: any, message?: string): void;
Expand All @@ -2238,6 +2258,7 @@ declare module "assert" {
doesNotThrow(block: Function, message?: string): void;
ifError(value: any): void;
AssertionError: typeof AssertionError;
strict: AssertStrict;
}
}

Expand Down