Skip to content

Problems with calling methods from class under namespace #127

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

Closed
MaxGraey opened this issue Jun 4, 2018 · 2 comments
Closed

Problems with calling methods from class under namespace #127

MaxGraey opened this issue Jun 4, 2018 · 2 comments
Labels

Comments

@MaxGraey
Copy link
Member

MaxGraey commented Jun 4, 2018

Just synthetic minimal example:

import "allocator/arena";

export namespace safe {
  export class U64 {
    constructor(
      public lo: u32,
      public hi: u32 = 0
    ) {}

    static addLo(a: U64, b: U64): U64 {
      return new U64(a.lo + b.lo);
    }
  }
}

var a = new safe.U64(1);
var b = new safe.U64(2);
var c = safe.U64.addLo(a, b);

Output errors:

ERROR TS2304: Cannot find name 'U64'.

     static addLo(a: U64, b: U64): U64 {
                     ~~~
 in main.ts(10,20)

ERROR TS2304: Cannot find name 'U64'.

     static addLo(a: U64, b: U64): U64 {
                     ~~~
 in main.ts(10,20)

ERROR TS2322: Type 'void' is not assignable to type '<auto>'.

 var c = safe.U64.addLo(a, b);
                  ~~~~~~~~~~~
 in main.ts(18,17)
...
@MaxGraey MaxGraey changed the title Problems with calling contructor and methods from class under namespace Problems with calling methods from class under namespace Jun 4, 2018
@dcodeIO
Copy link
Member

dcodeIO commented Jun 4, 2018

Minimal repro:

export namespace ns {
  class Cl {}
  export function fn(c: Cl): void {}
}

Appears resolving function parameter types currently doesn't traverse through namespaces.

@dcodeIO
Copy link
Member

dcodeIO commented Feb 7, 2019

Closing in favor of #473, which is our tracking issue for similar related issues now.

@dcodeIO dcodeIO closed this as completed Feb 7, 2019
dcodeIO added a commit that referenced this issue Feb 19, 2019
@dcodeIO dcodeIO mentioned this issue Feb 19, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants