-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Error: Debug Failure when importing AssertionError
from node:assert/strict
#58534
Comments
It repros in the playground too: TS playground. To repro you need to hover over |
Failing test case: // @strict: true
// @moduleResolution: node
// @noEmit: true
// @filename: node_modules/@types/node/index.d.ts
/// <reference path="assert.d.ts" />
/// <reference path="assert/strict.d.ts" />
// @filename: node_modules/@types/node/assert/strict.d.ts
declare module "node:assert/strict" {
import { strict } from "node:assert";
export = strict;
}
// @filename: node_modules/@types/node/assert.d.ts
declare module "assert" {
function assert(value: unknown, message?: string | Error): asserts value;
namespace assert {
class AssertionError extends Error {
actual: unknown;
expected: unknown;
code: "ERR_ASSERTION";
constructor(options?: {
message?: string | undefined;
actual?: unknown | undefined;
expected?: unknown | undefined;
});
}
namespace strict {
type AssertionError = assert.AssertionError;
}
const strict: Omit<typeof assert, "strict">;
}
export = assert;
}
declare module "node:assert" {
import assert = require("assert");
export = assert;
}
// @filename: index.ts
import { AssertionError } from 'node:assert/strict';
throw new AssertionError({
message: 'Hello',
actual: 3,
expected: 3,
}); |
The above test crashes even in TS 4.5 (and back even in 4.0 though with a slightly different error). So this most definitely is not a recent regression at all. |
This is an interesting one. So the symbol that leads to a crash is a result of We could propagate I need to think more about it but it seems like more stuff should get propagated onto that combined symbol from the mapped symbol. |
๐ Search Terms
Error: Debug Failure
๐ Version & Regression Information
Happened when using tsc v5.4.5 with
@types/node
. Wasnโt an issue before (older tsc and older@types/node
v20.12.12).โฏ Playground Link
https://github.com/rauschma/tsc-debug-failure
๐ป Code
Some of my compilerOptions in tsconfig:
๐ Actual behavior
๐ Expected behavior
No exception (normal operation)
Additional information about the issue
Possibly helpful:
tsc.js:53005
as follows. That told me that this problem was aboutAssertionError
.The text was updated successfully, but these errors were encountered: