Open
Description
π Search Terms
- isolated declarations
- object getter
- object setter
π Version & Regression Information
5.5.0-dev.20240514
β― Playground Link
π» Code
export const a = {
get b(): string {
return ""
},
set b(val: string) {
}
};
type StringAlias = string;
export const c = {
get d(): StringAlias {
return ""
},
set d(val: string) {
}
};
export const e = {
get f(): string {
return ""
},
set f(val: number) {
}
};
π Actual behavior
TypeScript emits:
export declare const a: {
b: string;
};
export declare const c: {
d: string;
};
export declare const e: {
get f(): string;
set f(val: number);
};
This is behaviour is not possible to reproduce for isolated declarations emitters, because it requires type comparisons for the types of the setter and getter.
π Expected behavior
One of:
Emit based on syntax, do not collapse a getter/setter pair with the same type to a property
export declare const a: {
get b(): string;
set b(val: string);
};
export declare const c: {
get d(): StringAlias;
set d(val: string);
};
export declare const e: {
get f(): string;
set f(val: number);
};
OR
Error on both c.d
and e.f
because return type of getter and setter do not match
Additional information about the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment