-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
When I do not specify return type to public functions the returning literal object is transformed to the object with internal properties.
Input code
function fn(input: { test1: number; test2: string }): { a: number; b: string } {
return {
a: 2,
b: 'str',
};
}
export function fn2(input: { test1: number; test2: string }) {
const { a } = fn({ test1: 25, test2: 'test' });
return {
a,
b: 'str',
};
}Expected output
function fn(input) {
return {
_internal_a: 2,
_internal_b: 'str',
};
}
function fn2(input) {
const { _internal_a: a } = fn();
return {
a,
b: 'str',
};
}
export { fn2 };Actual output
function fn(input) {
return {
_internal_a: 2,
_internal_b: 'str',
};
}
function fn2(input) {
const { _internal_a: a } = fn();
return {
_internal_a: a,
_internal_b: 'str',
};
}
export { fn2 };Additional context
If I specify return type explicitly it works as expected
function fn(input: { test1: number; test2: string }): { a: number; b: string } {
return {
a: 2,
b: 'str',
};
}
export function fn2(input: { test1: number; test2: string }): { a: number; b: string } { // this is the only change as return type is explicit now
const { a } = fn({ test1: 25, test2: 'test' });
return {
a,
b: 'str',
};
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working