Closed
Description
🔎 Search Terms
ts1166
🕗 Version & Regression Information
- This changed between versions 5.7.2 and 5.8.2
- This changed in commit or PR 61136
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
compiling this code with 5.8.2
import { inspect } from "node:util";
const custom = inspect.custom;
export class MyError extends Error {
[custom](): string {
return " ";
}
}
🙁 Actual behavior
generates the d.ts of
declare const custom: symbol; A computed property name in a class property declaration must have a simple literal type or a
export declare class MyError extends Error { 'unique symbol' type. [1166]
[custom]: () => string;
}
export {};
//# sourceMappingURL=restError.d.ts.map
Opening this in editor we are seeing error of
restError… 3 5 error 1166 A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. (lsp)
🙂 Expected behavior
d.ts generated by 5.7.2 is slightly different [x: symbol]: () => string;
and has no errors
export declare class MyError extends Error {
[x: symbol]: () => string;
}
//# sourceMappingURL=restError.d.ts.map
Additional information about the issue
every-ts bisect
pointing to this commit:
c3ae7c4 is the first bad commit
commit c3ae7c4 (HEAD)
Author: Gabriela Araujo Britto gabrielaa@microsoft.com
Date: Fri Feb 7 10:55:34 2025 -0800Revert return type narrowing (#61136)
Same issue exists in version 5.9.0-dev.20250305
Metadata
Metadata
Assignees
Labels
No labels