Skip to content

Static properties' types fail to be inferred #1252

Closed
@willemneal

Description

@willemneal

Here is an example in webassembly studio: https://webassembly.studio/?f=p106fcnkpp

function testGenric<T>(t: T): void {}

class StaticProperties {
  static get x(): i32 {
    return 0;
  }

  get i_x(): i32 {
    return 1;
  }
}

testGenric((new StaticProperties).i_x);
testGenric(StaticProperties.x);
ERROR TS1140: Type argument expected.

 testGenric(StaticProperties.x);
           ^
 in main.ts(18,11)


ERROR: 1 compile error(s)
    at exports.main (https://cdn.jsdelivr.net/npm/assemblyscript@nightly/dist/asc.js:7:826973)
    at Object.eval [as main] (eval at d (https://webassembly.studio/dist/main.bundle.js:1:1), <anonymous>:20:12)
    at r.eval [as promiseMaker] (eval at gulp (https://webassembly.studio/dist/main.bundle.js:1:34093), <anonymous>:28:7)
    at o.makePromise (https://webassembly.studio/dist/main.bundle.js:1:31658)
    at s.runInstance (https://webassembly.studio/dist/main.bundle.js:1:31954)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions