Skip to content

(rosetta): incorrect translation of inferred types to c# #3027

@nija-at

Description

@nija-at

🐛 Bug Report

In some cases, variables with inferred types get translated as __object in typescript.
This seems to happen when the type signature on the method is any.

See example below.

================= 7fbf857fd1de77d132905edb0484ed62d5d56ab4fe814ae1a79d0bf91aa83f57 =================
const expected = {
  Foo: 'Bar',
  Baz: 5,
  Qux: [ 'Waldo', 'Fred' ],
};
template.hasResourceProperties('Foo::Bar', expected);
----------- csharp -----------
__object expected = new Dictionary<string, object> {
    { "Foo", "Bar" },
    { "Baz", 5 },
    { "Qux", new [] { "Waldo", "Fred" } }
};
template.HasResourceProperties("Foo::Bar", expected);

The signature of the method used here is -

hasResourceProperties(type: string, props: any): void

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions