-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Description
🔎 Search Terms
"Debug Failure. type must be class or interface"
"Rest parameter cannot be optional crash"
"isConstructorAccessible crash strict mode"
"Mixin protected constructor crash"
🕗 Version & Regression Information
Versions tested: 5.7.3, 5.8.3, 5.9.3, Nightly
Behavior: All tested versions crash when --strict is enabled.
Condition: The crash only occurs when --strict is used. Without --strict, the compiler correctly identifies the syntax error (TS1047) and the semantic error (TS2674).
⏯ Playground Link
💻 Code
class Abstract {
protected constructor() {
}
}
class Concrete extends Abstract {
}
type Constructor<T = {}> = new (...args?: any[]) => T;
function Mixin<TBase extends Constructor>(Base: TBase) {
return class extends Base {
};
}
class Empty {
}
class CrashTrigger extends Mixin(Empty) {
public trigger() {
new Concrete();
}
}🙁 Actual behavior
.\ts-versions\nightly\node_modules\.bin\tsc.cmd --ignoreConfig --strict .\bugfind\2\noCrashOnMixin_m.ts
D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123191
throw e;
^
Error: Debug Failure. type must be class or interface
at getBaseTypes (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:57088:17)
at typeHasProtectedAccessibleBase (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:76955:23)
at typeHasProtectedAccessibleBase (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:76982:12)
at typeHasProtectedAccessibleBase (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:76982:12)
at isConstructorAccessible (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:76999:13)
at resolveNewExpression (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:76918:12)
at resolveSignature (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:77323:16)
at getResolvedSignature (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:77348:20)
at checkCallExpression (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:77456:23)
at checkExpressionWorker (D:\do\tscFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:80921:16)
.\ts-versions\nightly\node_modules\.bin\tsc.cmd --ignoreConfig .\bugfind\2\noCrashOnMixin_m.ts
bugfind/2/noCrashOnMixin_mutated_17.ts:7:40 - error TS1047: A rest parameter cannot be optional.
7 type Constructor<T = {}> = new (...args?: any[]) => T;
~
bugfind/2/noCrashOnMixin_mutated_17.ts:16:9 - error TS2674: Constructor of class 'Abstract' is protected and only accessible within the class declaration.
16 new Concrete();
~~~~~~~~~~~~~~
Found 2 errors in the same file, starting at: bugfind/2/noCrashOnMixin_mutated_17.ts:7
🙂 Expected behavior
The compiler should not crash. It should report the existing errors normally:
error TS1047: A rest parameter cannot be optional.
error TS2674: Constructor of class 'Abstract' is protected and only accessible within the class declaration.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
No labels