Skip to content

Commit

Permalink
add several zlip classes
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Aug 19, 2024
1 parent 3f57135 commit fff3e5c
Show file tree
Hide file tree
Showing 12 changed files with 1,362 additions and 83 deletions.
52 changes: 26 additions & 26 deletions src/node/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@
],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "src/node/tsconfig.json"
},
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/prefer-enum-initializers": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/unified-signatures": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/prefer-enum-initializers": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/restrict-template-expressions": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/unified-signatures": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
}
7 changes: 6 additions & 1 deletion src/node/internal/internal_assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ import {

import { inspect } from "node-internal:internal_inspect";

// This is used to properly set the type of the ok() function.
// Without this `assert.ok()` would throw the following error:
// Assertions require every name in the call target to be declared with an explicit type annotation.
import type { ok as okType } from 'node:assert';

interface ExtendedAssertionErrorConstructorOptions
extends AssertionErrorConstructorOptions {
generatedMessage?: boolean;
Expand Down Expand Up @@ -83,7 +88,7 @@ function assert(actual: unknown, message?: string | Error): asserts actual {
} as AssertionErrorConstructorOptions );
}
}
export const ok = assert;
export const ok: typeof okType = assert;

export function throws(
fn: () => void,
Expand Down
6 changes: 6 additions & 0 deletions src/node/internal/internal_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ export class ERR_STREAM_UNSHIFT_AFTER_END_EVENT extends NodeError {
}
}

export class ERR_BUFFER_TOO_LARGE extends NodeRangeError {
constructor(value: number) {
super("ERR_BUFFER_TOO_LARGE", `Cannot create a Buffer larger than ${value} bytes`);
}
}

export function aggregateTwoErrors(innerError: any, outerError: any) {
if (innerError && outerError && innerError !== outerError) {
if (Array.isArray(outerError.errors)) {
Expand Down
Loading

0 comments on commit fff3e5c

Please sign in to comment.