Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling unknown/any casting #25

Closed
timocov opened this issue Sep 24, 2021 · 0 comments · Fixed by #26
Closed

Incorrect handling unknown/any casting #25

timocov opened this issue Sep 24, 2021 · 0 comments · Fixed by #26
Labels
bug Something isn't working

Comments

@timocov
Copy link
Owner

timocov commented Sep 24, 2021

Bug report

Input code

function func(): unknown {
	const b = { value: 321 } as unknown;
	const c = { int: 222 } as unknown as InternalInterface;

	return {
		foo: 1,
		bar: b,
		baz: 3,
		c: c,
	};
}
function func2(): any {
	const b = { value: 321 } as any;
	const c = { field: 222 } as any as InternalInterface;
	return {
		foo: 1,
		bar: b,
		baz: 3,
		c: c,
	};
}

Expected output

function func() {
    var b = { value: 321 };
    var c = { _internal_int: 222 };

    return {
        foo: 1,
        bar: b,
        baz: 3,
        c: c,
    };
}
function func2() {
    var b = { value: 321 };
    var c = { _internal_field: 222 };

    return {
        foo: 1,
        bar: b,
        baz: 3,
        c: c,
    };
}

Actual output

function func() {
    var b = { _internal_value: 321 };
    var c = { _internal_int: 222 };

    return {
        _internal_foo: 1,
        _internal_bar: b,
        _internal_baz: 3,
        _internal_c: c,
    };
}
function func2() {
    var b = { _internal_value: 321 };
    var c = { _internal_field: 222 };

    return {
        _internal_foo: 1,
        _internal_bar: b,
        _internal_baz: 3,
        _internal_c: c,
    };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant