Closed
Description
π Search Terms
binding element alias declaration files
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
π» Code
export const fn1 = ({ prop:b }: { prop: number }) => { };
export const fn2 = ({ prop:b }: { prop: number }) => b;
export const fn3 = ({ prop:b }: { prop: number }): typeof b => 0;
π Actual behavior
b
is kept in all exported function signatures, even though it is never used. Even if we have typeof b
in the signature of the original function expression, the type printer will remove that and use the resolved type.
export declare const fn1: ({ prop: b }: {
prop: number;
}) => void;
export declare const fn2: ({ prop: b }: {
prop: number;
}) => number;
export declare const fn3: ({ prop: b }: {
prop: number;
}) => number;
π Expected behavior
b
is removed from all signatures since it will never be used. Even if the original type uses typeof
the resulting type will resolve any typeof expressions
Additional information about the issue
Related to #55654