9

Closed

Generics and recursion in 0.9.1

description

I've upgraded from 0.9.0.1 to 0.9.1, and this code started to produce compile errors
export module M {

    export interface IFoo<A> {
        a: A;
    }

    export function foo<A>(fn: (ifoo: IFoo<A>) => void ): void {
        // some code
        foo(fn);
    }
}
error TS2049: Parameter 'ifoo' of exported function is using inaccessible module 'filename.ts'.
It worked in previous version of tsc.

Upd: When I move cursor over 'fn' in VS, it shows correct type: 'fn: (ifoo: IFoo<A>) => void'
If I hover 'ifoo', VS shows it's type is 'any'
Closed Nov 19, 2013 at 8:32 PM by RyanCavanaugh
Thanks for reporting this! The issue has been fixed and can be tried out in the upcoming 0.9.5 release. We also have a beta available (https://typescript.codeplex.com/wikipage?title=TypeScript%200.9.5%20beta) if you'd like to try it out.

comments

schungx wrote Aug 7, 2013 at 9:45 AM

Seems to work if the function is abstracted into an interface:
export interface FooFunc<A>{ (ifoo: IFoo<A>): void; }

export function foo<A>(fn: FooFunc<A>): void { ... }

RyanCavanaugh wrote Aug 7, 2013 at 3:41 PM

Marking active.