-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Closed
Copy link
Description
Describe the bug
Input code
// @isolatedDeclarations: true
// @emitDeclarationOnly: true
let x = "";
export const foo = {
get [Symbol.toStringTag]() {
return x;
},
set [Symbol.toStringTag](value: string) {
x = value;
},
};
export class Foo {
#x = "";
get [Symbol.toStringTag]() {
return this.#x;
}
set [Symbol.toStringTag](value: string) {
this.#x = value;
}
}Config
Link to the code that reproduces this issue
SWC Info output
No response
Expected behavior
export declare const foo: {
[Symbol.toStringTag]: string;
};
export declare class Foo {
#private;
get [Symbol.toStringTag](): string;
set [Symbol.toStringTag](value: string);
}
Actual behavior
// @isolatedDeclarations: true
// @emitDeclarationOnly: true
export declare const foo: {
readonly [Symbol.toStringTag];
[Symbol.toStringTag]: string;
};
export declare class Foo {
#private;
get [Symbol.toStringTag]();
set [Symbol.toStringTag](value: string);
}
==================== Errors ====================
x TS9009: At least one accessor must have an explicit return type annotation with --isolatedDeclarations.
,-[$DIR/tests/fixture/symbol-getter-setter.ts:7:1]
6 | export const foo = {
7 | ,-> get [Symbol.toStringTag]() {
8 | | return x;
9 | `-> },
10 | set [Symbol.toStringTag](value: string) {
`----
x TS9009: At least one accessor must have an explicit return type annotation with --isolatedDeclarations.
,-[$DIR/tests/fixture/symbol-getter-setter.ts:17:1]
16 | #x = "";
17 | get [Symbol.toStringTag]() {
: ^^^^^^^^^^^^^^^^^^^^
18 | return this.#x;
`----
Version
N/A
Additional context
No response