microsoft / microsoft/TypeScript
Compiler crash: Debug Failure in visitEachChildOfIndexSignatureDeclaration
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
🔎 Search Terms
typescript debug failure index signature
visitEachChildOfIndexSignatureDeclaration
typescript compiler crash decorator addInitializer
invalid index signature decorator
typescript Debug Failure index signature
🕗 Version & Regression Information
- This is the behavior in the version I tested (TypeScript 5.9.3). I reviewed the FAQ and did not find entries related to this compiler crash.
⏯ Playground Link
💻 Code
function assingType(fn: Function, _ctx: ClassMethodDecoratorContext){
let fnName = _ctx.name
_ctx.addInitializer(function(this: {[key: string], any}) { // here is my sintaxis error
// Invalid type annotation. The compiler should report a type error,
// but instead it crashes with "Debug Failure".
this[fnName.toString()] = fn.bind(this);
})
return function wrapper (this: any,...args: any ) : void{
console.log(`class method mame ${fnName.toString()}`)
fn.call(this, ...args)
}
}
class Hello {
constructor(){
}
@assingType
doSometing (): void{
console.log("hello")
}
}
🙁 Actual behavior
C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:123168
throw e;
^
Error: Debug Failure.
at visitEachChildOfIndexSignatureDeclaration (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90865:13)
at visitEachChild (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90721:33)
at visitEachChild2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:133010:16)
at visitExistingNodeTreeSymbolsWorker (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:132899:23)
at visitExistingNodeTreeSymbols (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:132658:22)
at visitArrayWorker (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90535:49)
at visitNodes2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90506:19)
at visitEachChildOfTypeLiteralNode (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90911:7)
at visitEachChild (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:90721:33)
at visitEachChild2 (C:\Users\diazc\AppData\Roaming\npm\node_modules\typescript\lib_tsc.js:133010:16)
🙂 Expected behavior
The TypeScript compiler should not crash.
If the code is invalid, the compiler should emit a normal type error instead of throwing a "Debug Failure" during compilation.
Additional information about the issue
This code does not crash in the TypeScript Playground. The Playground only reports normal type-checking errors.
However, when compiling locally with tsc (TypeScript 5.9.3), the compiler crashes with a "Debug Failure" during compilation.
A screenshot of the stack trace from the local tsc execution is attached.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với mã TypeScript được cung cấp và tái hiện lỗi crash cục bộ bằng tsc 5.9.3, sau đó so sánh với kết quả trên Playground. Truy vết stack từ visitEachChildOfIndexSignatureDeclaration và sử dụng annotation của index signature không hợp lệ làm trường hợp tập trung. Hoàn tất khi trình biên dịch báo cáo một lỗi kiểu thông thường thay vì ném Debug Failure.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- compilers
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 48/100